AWS - Setup Elastic Beanstalk
Updated at 2015-10-02 08:46
Elastic Beanstalk application consists of the application, version and configuration; where environment is a version + configuration pairing.
Elastic Beanstalk:
Application
Version
Configuration
Environment = Version + Configuration
This checklist guides how to create basic Elastic Beanstalk application.
- Create New Application, top right in the AWS EB console.
- Application Info
Application Name: App Name
- Environment Type
Environment tier: Web Server Predefined configuration: PHP Environment type: Load balancing, auto scaling
- Application Version
Source: Upload your own zip a root of the project with "index.php"
- Environment Information
Environment name: appname-env Environment URL: appname-env.elasticbeanstalk.com
- Additional Resources
Create an RDS DB Instance with this environment If you require MySQL or PostgreSQL. Use multi-AZ, SSD and max 1 day backup period for production. Create this environment inside a VPC If you require Amazon Virtual Private Cloud functionality. Edit the security group that was created by for the app. Inbound: Custom TCP: 5432: */32 # http://checkip.amazonaws.com/ HTTP/HTTPS: 0.0.0.0/0
- Configuration Details
Instance type: t2.micro (~$7/month each) EC2 key pair: appname-eb-key-pair-us-west-1 (Created in EC2 console) Application health check URL: If you want to check non-root URL for application health. Instance profile: appname-eb-role (Created in IAM Management Console) Create New Role Role Name: appname-eb-role Role Type: Amazon EC2 Permissions: No Permissions
- Application Info
- After the definition:
Navigate to http://appname-env.elasticbeanstalk.com/
- Using Domain hosted by a third party:
- Create a CNAME for your www record that maps to
appname-env.elasticbeanstalk.com
. - Forward
example.com
towww.example.com
.
- Create a CNAME for your www record that maps to
- Using a Domain Hosted by Amazon Route 53:
- Find Load Balancer.
Get instance ID: i-456c32b7 Hosted Zone ID: Z215RUKSI1TBD5
- Find Load Balancer.
Optional:
- You should define environmental variables for AWS secret etc.
- You should deploy using the
eb
command line tool:eb deploy appname-env
- You can specify auto-scaling:
Environment type: Load balanced, auto scaling Number of instances: 2 - 5 Scale based on: Average network out Add instance when: > 6 000 000 Remove instance when: > 2 000 000
- If the defining as a worker, attach SQS queue using the EB dashboard.
Sources
- AWS in Action, Michael Wittig and Andreas Wittig