Skip to content

Instantly share code, notes, and snippets.

@thom-vend
Created November 18, 2020 21:45
Show Gist options
  • Save thom-vend/dc1a9f3304735751982798868c43b807 to your computer and use it in GitHub Desktop.
Save thom-vend/dc1a9f3304735751982798868c43b807 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3
import boto3
from columnar import columnar
AsgClient = boto3.client("autoscaling")
r = AsgClient.describe_auto_scaling_groups()
headers = ["Dyn?", "AutoScalingGroupName", "MinSize", "MaxSize", "DesiredCapacity"]
fixed = []
dynam = []
for asg in r["AutoScalingGroups"]:
if asg["MinSize"] == asg["MaxSize"] and asg["MaxSize"] == asg["DesiredCapacity"]:
fixed.append(
[
"FIXED",
asg["AutoScalingGroupName"],
asg["MinSize"],
asg["MaxSize"],
asg["DesiredCapacity"],
]
)
else:
dynam.append(
[
"DYNAM",
asg["AutoScalingGroupName"],
asg["MinSize"],
asg["MaxSize"],
asg["DesiredCapacity"],
]
)
print(columnar(fixed + dynam, headers, no_borders=True))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment