Can I get a bit of help with an automation script to bump up autoscaling groups

Hey there,
I have an autoscaling group that has my development environment on it, so that I don’t have to remember to shut it down it can scale down to 0 instances if unused. I currently have the command aliased to set the desired capacity to 1…

aws autoscaling set-desired-capacity --desired-capacity 1 --autonam…

I’d really like to be able to kick that up or down with a single command. I’m not great with the command line so I was wondering if I could get some help.

I’m working on a script that would query the autoscaling group and pull out the desired capacity, up it by 1/subtract 1 limit 0, and execute. My problem is the describe-autoscaling-groups returns json and I don’t know how to handle that in bash. Suggestions?


Related discussions:

Add “–query AutoScalingGroups[0].DesiredCapacity” to your call to describe-auto-scaling-groups to get just that field.

sweet thanks!

So I thought this was a fun little alias to use, like I mentioned I have dev machines that have the ability to scale down to zero to save money at the end of the day. I added this little alias to my bash profile and now I can say ‘agentup’ and ‘agentdown’ and it’ll adjust dev environment

alias agentup=‘aws autoscaling set-desired-capacity --desired-capacity $(( $(aws autoscaling describe-auto-scaling-groups --auto-scaling-group-names MYAUTOSCALEGROUPNAME --query AutoScalingGroups[0].DesiredCapacity)+1)) --auto-scaling-group-name MYAUTOSCALEGROUPNAME’