Skip to content

Instantly share code, notes, and snippets.

@fabioluciano
Created May 16, 2018 19:01
Show Gist options
  • Save fabioluciano/384619fe7abdcbf79e0539916cb99177 to your computer and use it in GitHub Desktop.
Save fabioluciano/384619fe7abdcbf79e0539916cb99177 to your computer and use it in GitHub Desktop.
Terminate all instances in ScalingGroups
import boto3
client = boto3.client('autoscaling')
scaling_groups = client.describe_auto_scaling_groups()
for scaling_group in scaling_groups['AutoScalingGroups']:
print(scaling_group['AutoScalingGroupName'])
client.update_auto_scaling_group(
AutoScalingGroupName = scaling_group['AutoScalingGroupName'],
MinSize=0,
DesiredCapacity = 0
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment