How to Stop, Start, Reboot, Terminate EC2 Instances from AWS CLI

Command to stop an EC2 Instance:

aws ec2 stop-instances --instance-ids INSTANCEID 

Command to start an EC2 Instance:

aws ec2 start-instances --instance-ids INSTANCEID 

Command to reboot an EC2 Instance

aws ec2 reboot-instances --instance-ids INSTANCEID

Command to terminate an EC2 Instance:

aws ec2 terminate-instances --instance-ids INSTANCEID

To perform action on multiple Instances, all the above 4 commands accept space separated list of Instance IDs as below:

--instance-ids INSTANCEID1 INSTANCEID2 INSTANCEID3

See also  How to delete an S3 bucket