AWS SysOps Exam Key Points: Auto Scaling Groups (ASG) and Launch Configurations
Lifecycle Hooks
- Lifecycle hooks allow custom actions to be executed during ASG instance initiation and termination.
- Default behavior: Instances go from
pending to in-service immediately.
- With lifecycle hooks:
- Pending Lifecycle: The Instance enters a pending wait state for initial setup scripts, then proceeds to move to in-service.
- Termination Lifecycle: The instance enters the terminating wait state for actions like log retrieval or AMI creation, andthen terminating proceeds to move to termination.

- Use-cases: Cleanup, log extraction, and health checks before instances start or are terminated.
- Integration with other AWS services: EventBridge, SNS, SQS for triggering actions based on lifecycle events.

Launch Configurations vs. Launch Templates
- Both specify parameters for launching EC2 instances (AMI, instance type, key pair, security groups, etc.).
- Launch Configurations:
- It cannot be edited; it must be recreated for changes.
- Considered legacy and not recommended for new implementations.
- Launch Templates:
- Support multiple versions and editing.
- Allow configuration reuse and inheritance.
- It can provision on-demand and spot instances or a mix.
- Support advanced features like placement groups, capacity reservations, dedicated hosts, and T2 unlimited burst.
- It was recommended by AWS for new implementations.
Auto Scaling with SQS
- Scale ASG based on SQS queue length using CloudWatch metrics and alarms.
- CloudWatch metric:
ApproximateNumberOfMessagesVisible.
- Alarm triggers scaling policy based on queue length.

Health Checks
- Ensure high availability with multi-AZ ASG and at least two instances.