Deploying to AWS: Need help with appspec.yml

Deploying to AWS: Need help with appspec.yml
0.0 0


I’ve been experimenting with AWS for about a day now but I can’t figure out how to configure the appspec.yml, and the official docs haven’t been much help. I’m most confused about the files destination, and the hooks. I have no idea what to put for any of them.
I figured the file source would just be the root, “/”.
Just to clarify further, I’m trying to deploy my portfolio to AWS on an EC2 instance.


Why are you using EC2?

Is your site dynamic or is it just using html, js and css? If so then you can host a website out of S3 which will cost a fraction of EC2.

As for the YAML, The sysadmin at my work made ours, but only to EBS (Elastic Beanstalk - a container service).

With EC2 we always did a ssh into the server and then did a connection to github from the command line, so we could clone, pull or push GitHub as needed.

On EBS we use to do a zip ( excluding git files like .git or .gitignore) of the source files and use the web GUI to upload the new deployment. This was later replaced with a codedeploy configuration on GitHub and the master branch.

S3 has a simple file upload GUI and can be configured to run as a website provided you are not using server side scripts (PHP, ASP, JSP, etc…). You can still use a dynamic site if it is based on the MEAN stack (MongoDb, Express, AngularJs and NodeJs). The MongoDb would be replaced by DynamoDb (an AWS MongoDb Clone), Angular and Express can be replaced by your preferred JS library, ReactJs for example. Anyways this is the basis of what is called Serverless. If you want to look at how to get this up and running I found a guide here…
It has one of the most detailed guides I have found to get up and running with Serverless.

Anyway I got side tracked there. S3 can be configured to have GitHub master publish to S3. If you want I can see if my co-worker has a tutorial on setting it up or the code deploy. Let me know.


Honestly I have no idea. There are so many different services, I thought EC2 would be the right one to use. I didn’t know you could host on S3 as well. For this particular app, my portfolio, I’m using EJS, node and css, but I have 2 other apps built with MERN that I wanted to deploy also. Can one still use Mongoose to interact with DynamoDB?
And yes that would be really great, thanks!! I’ve just started looking into AWS and it has my head turning in every direction.


I’ve had a lot of success deploying single page applications to github pages and then larger websites/projects to heroku. Both github and heroku have pretty simple and helpful docs to help you get your project deployed. I looked into AWS but it was much more than I needed for my portfolio and seemed like it is more for really, really large scale projects. Good luck getting your portfolio online!


Thanks for the reply! Actually my portfolio is already online on heroku, but I’m just worried about the really long initial load time. I feel like it would deter employers. Deploying to github looks really easy and simple, but my portfolio is a node app.


Ahh, I see - well, I think learning AWS is really marketable thing anyways :slight_smile: Yes, the loading time would be a problem. I think Heroku also offers paid plans so your project is always loaded but I’m not sure what the price is.


After a quick search I found a potential workaround to the loading time issue. Theres a site called herokuping, that pings the site every few minutes, although it might not work well with the free plan I have right now.


How is this going for you? I recently deployed the beta version of one of my webpages to Heroku here. The page loads slowly the first time but quickly if loaded again. Although I don’t understand it completely, I have read that the free tier may let the dyno go to sleep if unused for a certain duration and it can take some time to start up again.

I agree that knowing AWS is in itself a valuable skills to have these days. From what I’ve read the straight forward way to host a dynamic app like ours is indeed EC2. Basically get some microserver supported by the free tier (Ubuntu seems to be popular), configure it to support http/https, get it running, and then access it via SSH and clone the repo of your project onto that machine. Install your dependencies and then run it.


Well I was going to use the herokuping, but it’s possible that it could exceed the limits of the sandbox plan. I still haven’t figured out AWS, so for now, I just decided to bump the app up to the 7 a month plan, which keeps it on always. It’s not a permanent solution, though.


I was able to get AWS running basically by following this video and also this putty guide (I am on windows). You can compare the speed of the page below:

AWS seems way snapier to me