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,510 points
3,124 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
• 58,020 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,170 points
963 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, 2019 in AWS by Shashank
• 1,370 points
4,130 views
+1 vote
1 answer

How to find all instance Ids In AWS from command line?

Hi@akhtar, You can find one keyword --query in ...READ MORE

answered Jun 2, 2020 in AWS by MD
• 95,460 points
5,577 views
+15 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 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
4,036 views
+2 votes
1 answer
+3 votes
6 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
• 69,220 points
20,004 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, 2019 in AWS by Shashank
• 1,370 points
1,167 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP