Posts

Showing posts with the label aws-cli

Controlling EC2 Instance from CLI: AWS automations

Image
When you start learning few commands about AWS CLI you can plan to automate the process with simple bash shell script where you can include set of aws commands into it with simple bash script controls.  How to automate AWS EC2 stop/start using aws cli? Objective of this post is to develop a simple controlling script which can use the AWS CLI commands for start-instances, describe-instances, stop-instances and adding bash scripting logic to it. First we start experiment with each aws ec2 command, then we can proceed by collecting those successful commands to form a automation script. Let's explore now. How to automate AWS EC2 instance using aws-cli How to start an AWS EC2 instance "start-instances" command To start the aws instance you need to pass the instance-id as argument. Following is the command example. aws ec2 start-instances --instance-id i-instancenumber Please change to your instance-id value replace the instancenumber with yours. Execution output looks like ...