Search code examples
amazon-web-servicesaws-cli

AWS cli: How to stop instances and start EC2 instances


I want to start and stop EC2 instances using AWS-cli

How can i do this task.

I have setup aws cli on my pc.


Solution

  • Start an Amazon EC2 instance

    Documentation: start-instances — AWS CLI Command Reference

    aws ec2 start-instances --instance-ids i-xxx
    

    Stop an Amazon EC2 instance

    Documentation: stop-instances — AWS CLI Command Reference

    aws ec2 stop-instances --instance-ids i-xxx