π 05. Elastic Beanstalk
This guide provides step-by-step instructions to create a simple Elastic Beanstalk application (Node.js web server) using the AWS Management Console.
πͺ Step-by-Step Setupβ
Step 1: Open Elastic Beanstalkβ
- Go to AWS Console β Services β Elastic Beanstalk.
Step 2: Create a New Applicationβ
-
Click Create application.
- Enter an application name (e.g.,
MyApplication).
- Enter an application name (e.g.,
Step 3: Choose Environment Typeβ
- Select Web server environment (for web apps).
- Click Create environment.
Step 4: Configure Environment Informationβ
- Enter an Environment name (e.g.,
MyApplication-dev). - A domain name is auto-generated for access.
Step 5: Choose Platformβ
- Select Node.js as the platform.
- Leave defaults unchanged unless specific requirements exist.
Step 6: Upload Application Codeβ
- Under Application code, select Sample application.
- This deploys a sample Node.js app automatically.
Step 7: Select Environment Configurationβ
- Choose Single instance (Free Tier eligible).
- Optionally choose:
- High availability β Load Balanced setup.
- Custom configuration β Advanced options.

Step 8: Configure Service Access (IAM Roles)β
Elastic Beanstalk needs:
- Service Role:
elasticbeanstalk-service-role(To create Resources) - EC2 Instance Profile:
aws-elasticbeanstalk-ec2-role(EC2 to AWS communication)
If missing:
- Go to IAM Console β Roles β Create role.
- Choose AWS service β EC2.
- Attach policies:
AWSElasticBeanstalkWebTierAWSElasticBeanstalkWorkerTierAWSElasticBeanstalkMulticontainerDocker
- Name the role:
aws-elasticbeanstalk-ec2-role. - Return to Beanstalk and refresh to select the new role.

Step 9: Review and Createβ
- Click Next through optional screens (Networking, Database, etc.).
- Click Skip to review β verify all configurations.
- Ensure both roles (service + instance) are correctly assigned.
- Click Create environment.

Step 10: Monitor Environment Creationβ
- Beanstalk triggers a CloudFormation stack.
- In Elastic Beanstalk β Events, watch for:
CREATING_IN_PROGRESSβCREATE_COMPLETE
- CloudFormation provisions:
- EC2 instance(s), Security Groups, Auto Scaling Group, Elastic IP, etc.

Step 11: Verify Underlying AWS Resources (Optional)β
- EC2 Console: Check running instance (t2/t3.micro).
- Elastic IPs: Confirm if one is assigned.
- Auto Scaling: Single-instance group should appear.

Step 12: Test the Applicationβ
- On the Beanstalk environment page, click the environment URL/domain.
- The sample app should load (βCongratulations, you are now running Elastic Beanstalkβ¦β).

Step 13: Common Post-Setup Actionsβ
| Action | How to Access |
|---|---|
| Upload & Deploy New Version | Actions β Upload and Deploy |
| View Logs | Logs tab |
| Monitor Performance | Monitoring tab |
| Configure Updates/Settings | Configuration tab |
Step 14: Create Multiple Environments (Optional)β
- You can create environments like:
MyApplication-devMyApplication-prod
- Useful for separate staging/production setups.
Step 15: Cleanup Resourcesβ
To avoid charges:
- From the Application page, choose Actions β Delete application.
- Verify deletion of related:
- EC2 instances
- EIPs
- Load Balancers
- CloudFormation stacks
π‘ Notes & Tipsβ
- If IAM roles donβt autofill, create EC2 role manually first.
- Single instance setups are ideal for labs/free-tier.
- For production, prefer Multi-AZ / Load Balanced environments.
- Elastic Beanstalk uses CloudFormation under the hood.
- If creation fails, check Events tab for detailed error logs.
β
You now have a Node.js web app running on AWS Elastic Beanstalk!
Use the Configuration, Monitoring, and Logs sections to manage your environment as you iterate.