How can I prevent EC2 instance termination by Auto Scaling?

前端 未结 5 1290
[愿得一人]
[愿得一人] 2020-12-31 04:12

I would like to prevent EC2 instance termination by Auto Scaling feature if that instance is in the middle of some sort of processing.

Background:
Suppose I have

5条回答
  •  臣服心动
    2020-12-31 04:48

    aws-cli is your best friend..

    1. Disable your scale down policy on your autoscaling group.

    2. Create a cron job or scheduled task using aws-cli to:

      2a. Get the EC2 instances associated with the autoscaling group http://docs.aws.amazon.com/cli/latest/reference/autoscaling/describe-auto-scaling-instances.html

      2b. Next monitor the cloudwatch statistics on the EC2 instances http://docs.aws.amazon.com/AmazonCloudWatch/latest/DeveloperGuide/US_SingleMetricPerInstance.html http://docs.aws.amazon.com/cli/latest/reference/cloudwatch/get-metric-statistics.html

      2c. Terminate the idle EC2 instance(s) from your auto-scaling group http://docs.aws.amazon.com/cli/latest/reference/autoscaling/terminate-instance-in-auto-scaling-group.html

提交回复
热议问题