AWS Elastic Load Balancer is the “card dealer” that evenly distributes “cards” [traffic ] across “card players” [ EC2 instances ] .
Works across EC2 instances in multiple Availability Zones
- supports http, https, TCP and SSL traffic / listeners
- uses Route 53 DNS CNAME only
- supports internet facing and internal
- supports SSL offload / SSL termination at ELB, relieving load from EC2 instances
Idle Connection Timeout and Keep Alive Options
ELB sets the Idle timeout at 60 seconds for both connections; and will timeout if data is still being transferred. Increase this setting for longer operations, ( file uploads ), etc.
For https and http listeners, use Keep Alive load balancer to re-use back-end connections, reducing CPU.
AWS Cloud Watch for ELB and EC2
Service for monitoring all AWS resources and application in near real time. Collect and track metrics, collect and monitor log files, set alarms and react to changes in AWS environment. [ SNS notifications, kick off auto scaling group ]
Basic Monitoring / Every 5 minutes [ DEFAULT ]
Detailed Monitoring / every 1 minute ( more expensive )
Each account limited to 5000 alarms.
Metrics data retained two weeks by default.
CloudWatch Logs Agent available for automated way to send log data to CloudWatch Logs for EC2 if running AWS Linux or Ubuntu.
AWS/EC2 namespace includes the following default instance metrics:
CPU Metrics, Disk Metrics, Network Metrics,.
Auto Scaling and Launch Configuration
A Launch Configuration is basically a template that AWS Auto Scaling will use to spin up new instances. Launch Configurations are composed of:
- EC2 instance type
- Security Group
- Instance Key Pair
Auto-Scaling is basically provisioning servers on demand and releasing them when no longer needed – you spin up more servers when there is peak demand; e.g., black Friday, World Series ticket sales . .
Maintain Current Instance Levels – health checks on current instances; and if one dies; another will replace it.
Manual Scaling – This is a bad name for this group; because the auto-scaling itself is still automatic, the metrics input is manual .. e.g., you tell a change in the min, max capacity [ metrics, think max CPU, etc.. ] of group and Autoscaling will spin up more instances when your metrics are seen.
Scheduled Scaling – For predictable behavior [ Black friday thru christmas ] all actions performed automatically as a function of data and time.
Dynamic Scaling – you define different parameters, using cloud watch logs, network bandwidth ,etc
A scaling policy is used by Auto scaling with Cloud Watch alarms to determine when your AS group should scale in or scale out. Each Cloud watch alarm watches a single metric and sends a message when the metric breaches a threshold.