Created
November 18, 2020 21:45
-
-
Save thom-vend/dc1a9f3304735751982798868c43b807 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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