Here are step-by-step instructions you can use to deploy a Node.js application on Amazon Web Services (AWS) using Elastic Beanstalk:
1. Create an AWS Account: If you don’t have an AWS account, create one at https://aws.amazon.com by following the on-screen instructions.
1. Create a New Application in Elastic Beanstalk:
- Open the Elastic Beanstalk console in AWS.
- Click on “Create a new application.”
- Enter an application name and description.
- Choose the platform as Node.js.
1. Create an Environment:
- Click on “Create one now” in the environments section.
- Choose “web server environment.”
- Fill in the domain and description.
1. Upload Your Node.js App:
- Click on upload your code.
- Zip your Node.js project directory including the `package.json` file and upload it.
1. Configure More Options:
- Here you can configure your instances, auto-scaling, notifications, network, database, and security.
- Set the environment variables for your application using the `Software` link in the `Base` box.
1. Create Environment:
- After you have configured the settings as desired, click on “Create environment.” AWS will now set up your environment.
1. Test the AWS Deployment: In a few minutes, your environment will go green, which means it’s done and hosted. Now you can open the URL provided and see if your Node.js application is working.
Remember, AWS is a pay-as-you-go service, so you only pay for what you use, and you can stop using it whenever you want.