How to Deploy AWS ELASTIC BEANSTALK
Source: Dev.to
Overview
AWS Elastic Beanstalk is a managed cloud service that lets you deploy and run web applications without worrying about the underlying infrastructure. It supports Java, Python, Node.js, PHP, .NET, Ruby, Go, Docker, and more. The key benefits are fast deployment with minimal setup and automatic scaling based on traffic.
Prerequisites
- An AWS account
- Access to the AWS Management Console
Step‑by‑Step Deployment
1. Choose the Environment Tier
In the AWS Management Console, select Create a new environment and choose one of the following tiers:
- Web server environment – runs a website, web application, or web API that serves HTTP requests.
- Worker environment – runs a worker application that processes long‑running workloads on demand or on a schedule.
2. Provide Application Details
- Application name:
Stockwebapp - Environment name: (generated automatically, e.g.,
Stockwebapp‑env)
3. Select Platform
Choose the platform that matches your codebase, e.g., Node.js.
4. Configure Instance Settings
- Service role: Create or select an existing Elastic Beanstalk service role (
aws-elasticbeanstalk-service-role). This role allows Elastic Beanstalk to manage AWS resources on your behalf. - EC2 instance profile role: Use the EC2 instance profile role (
aws-elasticbeanstalk-ec2-role). This role is attached to the EC2 instances running your application. - Key pair: Create an EC2 key pair (public key stored on the instance, private key used for SSH access).
Networking
- Enable Public IP address if the instance must be reachable from the internet.
- Choose appropriate subnets, routing, and security groups for your environment.
5. Database and Tags (Optional)
- Add a database if required.
- Add any tags you need for resource organization.
- Click Next to continue.
6. Instance Type
- Select instance types (default options include
t3.microandt3.small).
7. AMI Selection
- Leave the AMI ID at its default value and proceed.
8. Health Monitoring
- Under Health Monitoring, select Enhanced.
- In CloudWatch Custom Metrics, choose metrics such as
ApplicationLatencyP50andApplicationLatencyP75from the dropdown.
9. Review and Launch
- Review all settings.
- Click Create environment.
- Elastic Beanstalk will provision the resources, which typically takes about 5 minutes.
Conclusion
Following these steps will set up a fully managed Elastic Beanstalk environment for your application, handling server provisioning, scaling, and health monitoring automatically.