Beanstalk is easy to deploy a simple app, but hard to integrate with other services and customize settings.
- Get into AWS Beanstalk
- Get Started
- Naming the sample application, choose
PHP
as our platform and start withSample Application
- Click Configuration More Options
- Try choose
Custom Configuration
and click modify on each panel - Read every field in each panel, try to understand the meaning, and how to control in free tier
- Choose back to
Low Cost
and clickCreate app
- Waiting for creating to finish, and access sample web page by
subdomain.region.elasticbeanstalk.com.
- Follow AWS Quick Start to try and understand more.
- In beanstalk Configuration Page, Choose Instances to modify
- Upgrade EC2 instance to t2.micro
- free tier
750 hours per month of Linux, RHEL, or SLES t2.micro instance usage
- free tier
- Set EBS (Amazon Elastic Block Storage) for your instance
- free tier
30 GB of Amazon Elastic Block Storage in any combination of General Purpose (SSD) or Magnetic, plus 2 million I/Os (with EBS Magnetic) and 1 GB of snapshot storage*
- free tier
- Try to connect ec2 instance by SSH
- Set EC2 key pair
- Set EC2 Key Pair in Beanstalk Configuration
security
section - Check port 22 open for public in EC2 security group and Network ACL
To add a Load Balancer, we have to enable load balancing
- In beanstalk Configuration Page, Choose Capacity to modify
- Change Type to
Load Balanced
, Follow step in docs: Environment Types - Setting for free tier
- Instances max:1, min:1
- Scaling Trigger aims to keep at least 1 healthy host
- In beanstalk Configuration Page, Choose Load balancer to modify
- Create a Classic Load Balancer for free tier
- Configuring a Classic Load Balancer
- Test Access Web Page by ELB endpoint
We don't want use Beanstalk integrated database because it's not for production use ─ Adding a Database to Your Elastic Beanstalk Environment
- Choose RDS Service
- Create RDS SQL database, choose one Database Engine you like
- 750 Hours per month of db.t2.micro database usage (applicable DB engines)
- 20 GB of General Purpose (SSD) database storage
- 20 GB of storage for database backups and DB Snapshots
- Check
Only enable options eligible for RDS Free Usage Tier
- Set everything
- Try to connect database from ec2
- Write a simple app that could get query result from database and show on web page