millisami
millisami

Reputation: 10161

How to use Fog (rubygem) to only start/stop the aws ec2 instance, but not terminate?

I've ec2 instance at aws as EBS store thats why I can start/stop the server.

When I start it again, the data is persisted between restarts.

But how to use fog or other ruby gems to automate this?

Upvotes: 3

Views: 695

Answers (1)

Haris Krajina
Haris Krajina

Reputation: 15286

Not sure what you are asking but here is a shot to stop insance via Fog

conn = Fog::Compute::AWS.new(
{
 :aws_access_key_id=>"YOUR_KEY",
 :aws_secret_access_key=>"YOUR_SECRET"}
)

conn.start_instances("i-a3432cbb")

conn.stop_instances("i-a3432cbb")

Upvotes: 2

Related Questions