user1480718
user1480718

Reputation: 321

Amazon EC2 Instance Remotely Start

Can someone elaborate more on the details of how to remotely start a EC2 instance remotely?

I have a Linux box set up locally, and would like to set up a cronjob on it to start an instance in Amazon EC2. How do I do that?

I've never worked with API's, if there are ways to use API's, can someone please explain how to do so...

Upvotes: 3

Views: 4624

Answers (1)

Nishant
Nishant

Reputation: 55866

Pretty Simple.

  1. Download EC2 API. There is a CLI with it.
  2. keep EC2_PRIVATE_KEY and EC2_CERT in as your envt variables, where they are private key and certificate files that you generate from EC2 console.
  3. then call ec2-reboot-instances instance_id [instance_id ...]

Done.

Refer: http://docs.amazonwebservices.com/AWSEC2/latest/CommandLineReference/ApiReference-cmd-RebootInstances.html


Edit 1

Do I download this directly onto my Linux box? And how do I access the CLI on the linux box of the EC2 API? Sorry to ask so many questions, just need to know detailed steps of how to do this.

  1. Yes. Download it from here

  2. If you have unzipped the API in /home/naishe/ec2api, you can call /home/naishe/ec2api/bin/ec2-reboot-instance <instance_id>. Or event better set unzipped location as your envt variable EC2_API_HOME and append $EC2_API_HOME/bin to your system's PATH.

Also, try investing some time on Getting Started Doc which is amazingly simple.

Upvotes: 5

Related Questions