Deploy a Node.js server to AWS EC2
Link to GitHub repository
- GUI deployed server [here]http://basicexpressserver-env.eba-d296yg2f.us-east-2.elasticbeanstalk.com/)
- CLI deployed server here
- Ensure repo has server setup but has no database
- PORT is set in .env file
- Choose NodeJS as your platform
- Create and upload a .zip file with your application source code
- Do not include
node_modules
orpackage-lock.json
- Do not include
This will create your application and environment in one step, giving you a full GUI from where you can manage the app
First, ensure that you've installed the aws cli and the aws eb command line utilities.
eb init
- Initializes your folder as an Elastic Beanstal application- Choose your region (
us-west-2
) - Choose
[Create new Application]
- Note: If you already have an application, you could also choose that to connect
- Answer the other questions as appropriate
- Choose Node.js at the correct version
- Choose your region (
eb create my-environment-name
- Create an "environment" for your app to reside ineb deploy
to deploy your new application to your new environment- You'll also use this whenever you make code changes
You can then use some other eb
commands to manage your apps
eb open
to open your app in the browsereb list
to get a list of appseb ssh
to ssh (login) to one of your appseb health
to get a health check on your environments