xbar to the rescue!
I was looking for a convenient way to start or stop AWS EC2 instances, for example from the MacOS menu bar.
And the internet / GitHub did not let me down: xbar is the way to go!
Plugins
With xbar you can use many plugins; I am just using this one to start my EC2 instances:
xbar-plugins/ec2-start-stop.1h.sh at main · matryer/xbar-plugins
The installation notes are in that file as well:
The plugin folder is ~/Library/Application Support/xbar/plugins
Dependencies
Be also aware of the Dependencies:
awscli (https://aws.amazon.com/cli/)
jq (https://stedolan.github.io/jq/)
That means you have to setup your awscli before e. g. the command aws ec2 describe-instances
should output your current EC2 instances – then you are good to go to use the AWS profile within xbar. I created a new AWS profile just for EC2 management and added that to AWS CLI.
Conclusion
The setup was quite straightforward – and if you already have an AWS CLI profile setup it is even quicker. I like the fast and easy way to start my EC2 instances for demos. All my EC2 instances are ALWAYS stopped at 6PM every day with an AWS CloudFormation stack https://aws.amazon.com/premiumsupport/knowledge-center/stop-start-instance-scheduler/
NONE of my VMs are started automatically, I always do that via xbar (or the AWS mobile application) on demand – to save costs and also save resources. 🌱