Stopping then starting EC2 from command line

0 votes

I'm trying to stop and then immediately start (NOT REBOOT) my Amazon EC2 server from withinmy instance

I have CLI (Command Line Interface Tools) and am running a Windows 2012 server.

Basically, I want to ec2-stop-instances from a batch, and then ec2-start-instances right after. But I want the start-instances to run after a minute or so.

Is there a way to send the command and ask Amazon to wait a minute before it is run?

This way, running the batch script will stop then start the instance.

Again, I can't use reboot. For some reason, it does not work with my needs

Aug 24, 2018 in AWS by bug_seeker
• 15,360 points
101 views

1 answer to this question.

+1 vote

I understand this post is 3 years old, but it is possible to do this now with the AWS CLI, https://docs.aws.amazon.com/cli/latest/reference/ec2/stop-instances.html

aws ec2 stop-instances --instance-ids

aws ec2 start-instances --instance-ids

This could also be done from a Lambda Function, and scheduled

answered Aug 24, 2018 by Priyaj
• 57,300 points

Related Questions In AWS

0 votes
1 answer

Terminating and EC2 instance by command line

There is no command to terminate all ...READ MORE

answered Aug 9, 2018 in AWS by Archana
• 4,110 points
25 views
0 votes
2 answers

Unable to insert item to DynamoDb from command Line

Basically your command line here is unable ...READ MORE

answered Feb 23 in AWS by Shashank
• 1,350 points
198 views
+13 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 26, 2018 in DevOps & Agile by DragonLord999
• 8,380 points
252 views
0 votes
1 answer
+3 votes
5 answers

How to move files from amazon ec2 to s3 bucket using command line

Hey, 3 ways you can do this: To ...READ MORE

answered Oct 9, 2018 in AWS by Omkar
• 68,160 points
4,433 views
0 votes
2 answers

How to configure Amazon EC2 command line interface?

You can use this command to create ...READ MORE

answered Feb 23 in AWS by Shashank
• 1,350 points
118 views