ASG Flashcards
This deck aims to help retain concepts related to the AWS ASG service.
What configuration template does an Auto Scaling Group use to launch EC2 instances?
Launch Configuration, defines:
- AMI
- Instance type
- Storage
- Key pair
- Networking
- Security groups
- User-data
- Instance IAM role
Is not editable and does not support versioning
Which configuration template offers more features than a Launch Configuration?
A Launch Template provides similar functionality to a Launch Configuration but with additional features such as placement groups, capacity reservations, and elastic graphics, it can be used with both Auto Scaling Groups and individual EC2 instances and supports versioning
What are the primary features of an ASG?
- Provides automatic scaling and self-healing for EC2 instances
- Utilizes Launch Templates or Launch Configurations
- Configurable with min, max, and desired, capacity sizes
- Maintains the desired number of running instances by provisioning or terminating them as needed
What AWS service manages a collection of EC2 instances as a logical group for automatic scaling and management, and also provides features like health check replacements and scaling policies?
Auto Scaling Group (ASG)
What types of scaling policies does an ASG support?
- Manual Scaling
- Scheduled Scaling
- Dynamic Scaling (Simple Scaling, Step Scaling, Target Tracking Scaling)
What architectural components automate the scaling process in an ASG by adjusting the desired capacity based on specific metrics like CPU utilization?
Scaling Policies (not required), an ASG can be configured with static values for minimum, maximum, and desired capacity without scaling policies
Which ASG Scaling Policy allows for manual adjustments to the desired capacity?
Manual Scaling, which is useful for testing or urgent adjustments
Which ASG Scaling Policy adjusts the desired capacity based on a predefined schedule?
Scheduled Scaling
Which ASG Dynamic Scaling Policy adjusts capacity based on a single scaling adjustment, with a cooldown period between actions?
Simple Scaling - adds or removes a static number of instances based on alarm states
For example:
If ASGAverageCPUUtilization > 50%, add 2 instances
If ASGAverageCPUUtilization < 50%, remove 2 instances
Which ASG Dynamic Scaling Policy adjusts capacity based on a series of scaling adjustments known as step adjustments, varying with the size of the alarm breach?
Step Scaling - allows for detailed rules and quicker responses to more extreme changes, defines upper and lower bounds and reacts more flexibly to changing load patterns
For example:
If ASGAverageCPUUtilization > 50%:
- 50%-59%: Do nothing
- 60%-69%: Add 1 instance
- 70%-79%: Add 2 instances
If ASGAverageCPUUtilization < 50%:
- 40%-49%: Do nothing
- 30%-39%: Remove 1 instance
- 20%-29%: Remove 2 instances
Which ASG Dynamic Scaling Policy adjusts capacity based on a CloudWatch metric and a target metric value?
Target Tracking Scaling
Sets an ideal metric (e.g., CPU utilization = 60%), ASG automatically adjusts the capacity to maintain the metric at the target value
In ASG Scaling Policies, which attribute (value in seconds) determines the waiting period between consecutive scaling actions?
Cooldown Period
Can ASG Scaling Policies be based on the number of visible messages in an SQS queue?
Yes, using the ApproximateNumberOfMessagesVisible
metric, is a common approach in architectures for worker pools
How does ASG perform health checks on EC2 instances?
By default, ASG uses status checks to monitor EC2 instances, if an instance fails a status check, ASG terminates the instance and provisions a new one, providing self-healing capabilities
How can application awareness be provided to an ASG?
By integrating the ASG with an ELB and configuring ALB health checks instead of default EC2 status checks
How does the billing model for ASG work?
There is no cost for using ASG itself, only for the provisioned resources
Which ASG scaling policy attribute should be used to prevent rapid scaling?
The Cooldown Period
What EC2 instance sizes are best for granular scaling with ASG?
Smaller instance sizes
Which AWS services are commonly used together to provide elasticity and infrastructure abstraction?
ASG and ELB
What do ASG and a Launch Template define?
- ASG defines WHEN and WHERE
- Launch Template defines WHAT
What processes are available in EC2 Auto Scaling?
Each process can be in either RESUME or SUSPEND states, allowing to suspend activities of ASG on a specific instance, making it ‘Standby’ and then returning it to ‘InService’:
- Launch
- Terminate
- AddToLoadBalancer
- AlarmNotification
- AZRebalance
- HealthChecks
- InstanceRefresh
- ReplaceUnhealthy
- ScheduledActions
Which EC2 Auto Scaling process adds instances to ASG when the group scales out or for other reasons, such as adding instances to a warm pool?
“Launch” process
Which EC2 Auto Scaling process adds instances to the attached load balancer target group when they are launched?
“AddToLoadBalancer” process
Which EC2 Auto Scaling process removes instances from ASG when the group scales in or for other reasons, such as exceeding the maximum lifetime duration or failing a health check?
“Terminate” process
Which EC2 Auto Scaling process accepts notifications from CloudWatch alarms associated with dynamic scaling policies?
“AlarmNotification” process
Which EC2 Auto Scaling process balances the number of EC2 instances evenly across all specified AZs when the group becomes unbalanced, such as when a previously unavailable AZ returns to a healthy state?
“AZRebalance” process
Which EC2 Auto Scaling process checks the health of instances and marks an instance as unhealthy if Amazon EC2 or ELB indicates the instance is unhealthy?
“HealthChecks” process
Which EC2 Auto Scaling process terminates instances marked as unhealthy and then creates new instances to replace them?
“ReplaceUnhealthy” process
Which EC2 Auto Scaling process terminates and replaces instances using the instance refresh feature?
“InstanceRefresh” process
Which EC2 Auto Scaling process performs scheduled scaling actions created by you or generated when you create an AWS Auto Scaling scaling plan and enable predictive scaling?
“ScheduledActions” process
Provide an example of EC2 status checks for ASG.
- UNHEALTHY: Stopping, Stopped, Terminated, Shutting Down, or Impaired (not 2/2 checks passed)
- HEALTHY: Running with 2/2 checks passed
What health check types are available for ASG?
- EC2 Status Checks (default)
- ALB-provided Health Checks (can be enabled)
- Custom Health Checks (can be configured)
Which ASG attribute specifies the minimum amount of time (in seconds) to keep a new instance in service before terminating it if it is found to be unhealthy?
The Health Check Grace Period (default is 300 seconds)
What happens to an EC2 instance when an ASG Lifecycle Hook pauses it?
EC2 instance remains in a wait state until lifecycle action is completed using:
- complete-lifecycle-action
command
- CompleteLifecycleAction
operation
- until the timeout period ends (default is one hour)
Which ASG feature allows you to perform custom actions by pausing instances as they are launched or terminated?
ASG Lifecycle Hooks, which support integration with SNS for transition notifications and EventBridge to initiate other processes based on hooks
How does the EC2 Auto Scaling state change when using ASG Lifecycle Hooks?
PENDING ->
PENDING: Wait ->
PENDING: Proceed ->
InService
Terminating -> Terminating: Wait -> Terminating: Proceed -> Terminated
An Auto Scaling group has a maximum capacity of 3, a current capacity of 2, and a scaling policy that adds 3 instances, when executing this scaling policy, what is the expected outcome?
Auto Scaling adds only 1 instance to the group