Gabriel Ferreira
Gabriel Ferreira

Reputation: 55

OpsWorks terminate instance

Does anyone know, in instances timebased, how to terminate rather than stop every time she goes to stop?

I'm trying to terminate by recipe, but it can not proceed.

Upvotes: 1

Views: 241

Answers (2)

dgtized
dgtized

Reputation: 3382

It's easy enough to use the Opsworks API to do this directly;

require 'aws-sdk-core'
opsworks = Aws::OpsWorks::Client.new region: 'us-east-1'
opsworks.stop_instance(instance_id: instance_id)

begin
  sleep 5
end until(opsworks.describe_instances(instance_ids: [instance_id]).
            instances.first.status == 'stopped')

opsworks.delete_instance(instance_id: instance_id)

Upvotes: 2

Imran Ahmed
Imran Ahmed

Reputation: 1066

You could terminate by disabling the instance termination status and deleting it directly from the EC2 api

Upvotes: 1

Related Questions