Skip to content

api.aws.ec2.terminateInstances

tristanls edited this page Nov 25, 2012 · 3 revisions

Terminate EC2 instances.

Since Version 0.0.0
Scope
accepts: public

Parameters

All parameters are optional, unless otherwise indicated.

awsAccessKeyId AKIAIOSFODNN7EXAMPLE required AWS Access Key Id
instanceIds [ "i-aEXAMPLE", "i-bEXAMPLE" ] required EC2 instances to terminate
secretAccessKey wJalrXUtnFEMI/K7MDENG+bPxRfiCYEXAMPLEKEY required AWS Secret Access Key
securityToken tnFEMI/K7MDtnFEMI/K7MDtnFEMI/K7MD security token to include in the request

Response fields

Response

Single instance response.

requestId b11c694a-6a7f-44a0-9439-feda01571000 AWS EC2 request id for idempotency guarantee
reservationId r-dEXAMPLE Reservation Id of launched instance
ownerId 12345EXAMPLE Owner Id of launched instance
groupSet {"item":{"groupId":"sg-eEXAMPLE... Groups of launched instance
instancesSet {"item":{INSTANCE}} Set of launched instance

Multiple instances response.

requestId b11c694a-6a7f-44a0-9439-feda01571000 AWS EC2 request id for idempotency guarantee
reservationSet {"item":[RESERVATION,RESERVATION] Launched instances (see RESERVATION below)

RESERVATION (example)

{
  "reservationId":"r-dEXAMPLE",
  "ownerId":"12345EXAMPLE",
  "groupSet":{
    "item":{
      "groupId":"sg-eEXAMPLE",
      "groupName":"default"
    }
  },
  "instancesSet":{
    "item":[ INSTANCE, INSTANCE ]
  }
}

INSTANCE (example)

{
  "instanceId":"i-018bc87e",
  "imageId":"ami-3d4ff254",
  "instanceState":{
    "code":"0",
    "name":"terminating"
  },
  "amiLaunchIndex":"0",
  "instanceType":"t1.micro",
  "launchTime":"2012-11-25T17:37:41.000Z",
  "placement":{
    "availabilityZone":"us-east-1b",
    "tenancy":"default"
  },
  "kernelId":"aki-825ea7eb",
  "monitoring":{
    "state":"disabled"
  },
  "groupSet":{
    "item":{
      "groupId":"sg-eEXAMPLE",
      "groupName":"default"
    }
  },
  "stateReason":{
    "code":"terminating",
    "message":"terminating"
  },
  "architecture":"x86_64",
  "rootDeviceType":"ebs",
  "rootDeviceName":"/dev/sda1",
  "virtualizationType":"paravirtual",
  "hypervisor":"xen",
  "ebsOptimized":false
}

Error

message Error message Error message

Example

Request

crosstalk.emit( 
  "~crosstalk.api.aws.ec2.stopInstances", 
  {
    awsAccessKeyId : "KEYNAME",
    instanceIds : [ "i-018bc87e" ],
    secretAccessKey : "wJalrXUtnFEMI/K7MDENG+bPxRfiCYEXAMPLEKEY"
  }, 
  "~crosstalk", 
  function ( error, response ) { /* ... */ } 
);

Response:

{
  "requestId":"1970fe32-f1cd-48c6-abe3-3f8d41b31526",
  "reservationId":"r-dEXAMPLE",
  "ownerId":"12345EXAMPLE",
  "groupSet":{
    "item":{
      "groupId":"sg-eEXAMPLE",
      "groupName":"default"
    }
  },
  "instancesSet":{
    "item":{
      "instanceId":"i-018bc87e",
      "imageId":"ami-3d4ff254",
      "instanceState":{
        "code":"0",
        "name":"terminating"
      },
      "amiLaunchIndex":"0",
      "instanceType":"t1.micro",
      "launchTime":"2012-11-25T17:37:41.000Z",
      "placement":{
        "availabilityZone":"us-east-1b",
        "tenancy":"default"
      },
      "kernelId":"aki-825ea7eb",
      "monitoring":{
        "state":"disabled"
      },
      "groupSet":{
        "item":{
          "groupId":"sg-eEXAMPLE",
          "groupName":"default"
        }
      },
      "stateReason":{
        "code":"terminating",
        "message":"terminating"
      },
      "architecture":"x86_64",
      "rootDeviceType":"ebs",
      "rootDeviceName":"/dev/sda1",
      "virtualizationType":"paravirtual",
      "hypervisor":"xen",
      "ebsOptimized":false
    }
  }
}

Error:

{
  "message": "Error message"
}