Auto Scaling Monitoring
In this, we will learn the concepts of Auto Scaling Monitoring.
Auto Scaling can monitor instances and groups by
- Health checks – - EC2 Auto Scaling periodically performs health checks on instances in the Auto Scaling group
 - It identifies unhealthy instances
 - Auto Scaling Monitoring finds health status using EC2 status checks, ELB health checks, or custom health checks.
 
- CloudWatch metrics - EC2 Auto Scaling publishes data points to Amazon CloudWatch
 - CloudWatch retrieve statistics about those data points as ordered set of time series data or metrics.
 - use these metrics to verify that system is working as expected.
 
- CloudWatch Events - EC2 Auto Scaling can also submit events to CloudWatch Events
 - Event submission is when
 - Auto Scaling groups launch or terminate instances,
 - lifecycle action occurs.
 - Can invoke Lambda function when the event occurs.
 
- SNS notifications - EC2 Auto Scaling can send Amazon SNS notifications
 - SNS sent, when groups launch or terminate instances.
 
- CloudTrail logs - CloudTrail tracks calls to EC2 Auto Scaling API by
 - It stores the information in log files in S3 bucket
 - Use log files to monitor activity of your Auto Scaling groups.
 - Logs include - which requests were made,
 - source IP addresses of requests
 - who made the request
- when the request was made
 
 
Instance Health Status
EC2 Auto Scaling finds health status of an instance using one or more of the following:
- Status checks by EC2 and includes both instance and system status checks.
- Health checks provided by Elastic Load Balancing.
 - custom health checks.
 
- Instance is considered unhealthy in any state other than running or if system status is impaired,
- unhealthy instance is terminated and replacement is launched
- Following states makes instance unhealthy
- stopping
 - stopped
 - terminating
 - terminated
 
Auto Scaling Group Metrics
The AWS/AutoScaling namespace includes the following metrics.
| Metric | Description | 
| GroupMinSize | The minimum size of the Auto Scaling group. | 
| GroupMaxSize | The maximum size of the Auto Scaling group. | 
| GroupDesiredCapacity | The number of instances that the Auto Scaling group attempts to maintain. | 
| GroupInServiceInstances | The number of instances that are running as part of the Auto Scaling group. This metric does not include instances that are pending or terminating. | 
| GroupPendingInstances | The number of instances that are pending. A pending instance is not yet in service. This metric does not include instances that are in service or terminating. | 
| GroupStandbyInstances | The number of instances that are in a Standby state. Instances in this state are still running but are not actively in service. | 
| GroupTerminatingInstances | The number of instances that are in the process of terminating. This metric does not include instances that are in service or pending. | 
| GroupTotalInstances | The total number of instances in the Auto Scaling group. This metric identifies the number of instances that are in service, pending, and terminating. | 
CloudWatch Events
- It can automate AWS services and respond to system events as
- application availability issues
 - resource changes
 
- Events from AWS services are delivered to CloudWatch Events in real time.
- Define rules to indicate actions to perform, against events
- EC2 Auto Scaling can send events to CloudWatch Events for events
- EC2 Instance-launch Lifecycle Action
 - EC2 Instance Launch Successful
 - EC2 Instance Launch Unsuccessful
 - EC2 Instance-terminate Lifecycle Action
 - EC2 Instance Terminate Successful
 - EC2 Instance Terminate Unsuccessful
 
SNS Notifications
EC2 Auto Scaling can send SNS notifications against following events
| Event | Description | 
| autoscaling:EC2_INSTANCE_LAUNCH | Successful instance launch | 
| autoscaling:EC2_INSTANCE_LAUNCH_ERROR | Failed instance launch | 
| autoscaling:EC2_INSTANCE_TERMINATE | Successful instance termination | 
| autoscaling:EC2_INSTANCE_TERMINATE_ERROR | Failed instance termination | 
The message includes the following information:
- Event — The event.
- AccountId — The AWS account ID.
- AutoScalingGroupName — The name of the Auto Scaling group.
- AutoScalingGroupARN — The ARN of the Auto Scaling group.
- EC2InstanceId — The ID of the EC2 instance.
AWS Certified DevOps Engineer Free Practice TestTake a Quiz
		