Asynchronous behavior of the Amazon EC2 REST adapter
The BMC Atrium Orchestrator Application Adapter for Amazon EC2 is an asynchronous API call-based adapter. The adapter actions which involve creating a resource in Amazon Cloud generally return the provisioned resource's identifier and its current state (like 'pending'). To further query the resource's provisioning state and whether the provisioning activity completed successfully, use the corresponding 'Describe' operation on the resource to gather more details.
For example, when an instance is launched using the run-instances
operation, the adapter response returns the <instanceId>
and the <instanceState>
as follows:
<amazon-ec2-rest-response>
<metadata>
<status>success</status>
</metadata>
<RunInstancesResponse>
<reservationId>r-eb6237df</reservationId>
<ownerId>246495073671</ownerId>
<groupSet>
<item>
<groupId>sg-84cfffb4</groupId>
<groupName>launch-wizard-1</groupName>
</item>
</groupSet>
<instancesSet>
<item>
<instanceId>i-fc6cabca</instanceId>
<imageId>ami-b8a63b88</imageId>
<instanceState>
<code>0</code>
<name>pending</name>
</instanceState>
<privateDnsName />
<dnsName />
<stateReason>
<code>pending</code>
<message>pending</message>
</stateReason>
<keyName>test01</keyName>
<amiLaunchIndex>0</amiLaunchIndex>
<productCodes />
<instanceType>m1.small</instanceType>
<launchTime>Wed Dec 11 05:34:17 EST 2013</launchTime>
<placement>
<availabilityZone>us-west-2a</availabilityZone>
<groupName />
<tenancy>default</tenancy>
</placement>
<kernelId>aki-6065f250</kernelId>
<ramdiskId />
<monitoring>
<state>pending</state>
</monitoring>
<privateIpAddress />
<ipAddress />
<rootDeviceType>ebs</rootDeviceType>
<rootDeviceName>/dev/sda1</rootDeviceName>
<blockDeviceMapping />
</item>
<item>
<instanceId>i-e26cabd4</instanceId>
<imageId>ami-b8a63b88</imageId>
<instanceState>
<code>0</code>
<name>pending</name>
</instanceState>
<privateDnsName />
<dnsName />
<stateReason>
<code>pending</code>
<message>pending</message>
</stateReason>
<keyName>test01</keyName>
<amiLaunchIndex>1</amiLaunchIndex>
<productCodes />
<instanceType>m1.small</instanceType>
<launchTime>Wed Dec 11 05:34:17 EST 2013</launchTime>
<placement>
<availabilityZone>us-west-2a</availabilityZone>
<groupName />
<tenancy>default</tenancy>
</placement>
<kernelId>aki-6065f250</kernelId>
<ramdiskId />
<monitoring>
<state>pending</state>
</monitoring>
<privateIpAddress />
<ipAddress />
<rootDeviceType>ebs</rootDeviceType>
<rootDeviceName>/dev/sda1</rootDeviceName>
<blockDeviceMapping />
</item>
</instancesSet>
</RunInstancesResponse>
</amazon-ec2-rest-response>
To query the final status of the provisioned instance, use the describe-instances
operation using the <instance-id>
as shown in the following adapter request:
<amazon-ec2-rest-request>
<operation-name>describe-instances</operation-name>
<parameters>
<instances-set>
<item>
<instance-id>i-fc6cabca</instance-id>
</item>
<item>
<instance-id>i-e26cabd4</instance-id>
</item>
</instances-set>
</parameters>
</amazon-ec2-rest-request>
Based on the provisioning cycle, the instance might be 'available' in a few minutes. Therefore, a loop in a workflow around the describe-instances
operation invocation can determine the outcome of the run-instances
operation.
If the provisioning is successful, the state of the instance is 'running' as shown in the following response. In case of an error, the response contains either of the following:
- the error details
- the instance details with no information because the instance was not launched
<amazon-ec2-rest-response>
<metadata>
<status>success</status>
</metadata>
<DescribeInstancesResponse>
<reservationSet>
<item>
<reservationId>r-eb6237df</reservationId>
<ownerId>246495073671</ownerId>
<groupSet>
<item>
<groupId>sg-84cfffb4</groupId>
<groupName>launch-wizard-1</groupName>
</item>
</groupSet>
<instancesSet>
<item>
<instanceId>i-fc6cabca</instanceId>
<imageId>ami-b8a63b88</imageId>
<instanceState>
<code>80</code>
<name>stopped</name>
</instanceState>
<privateDnsName></privateDnsName>
<dnsName></dnsName>
<stateReason>
<code>Client.UserInitiatedShutdown</code>
<message>Client.UserInitiatedShutdown: User initiated shutdown</message>
</stateReason>
<keyName>test01</keyName>
<amiLaunchIndex>0</amiLaunchIndex>
<productCodes />
<instanceType>m1.small</instanceType>
<launchTime>Wed Dec 11 05:34:17 EST 2013</launchTime>
<placement>
<availabilityZone>us-west-2a</availabilityZone>
<groupName></groupName>
<tenancy>default</tenancy>
</placement>
<kernelId>aki-6065f250</kernelId>
<ramdiskId />
<monitoring>
<state>enabled</state>
</monitoring>
<privateIpAddress />
<ipAddress />
<rootDeviceType>ebs</rootDeviceType>
<rootDeviceName>/dev/sda1</rootDeviceName>
<blockDeviceMapping>
<item>
<deviceName>/dev/sda1</deviceName>
<ebs>
<volumeId>vol-a2b27b8a</volumeId>
<status>attached</status>
<attachTime>Wed Dec 11 05:34:20 EST 2013</attachTime>
<deleteOnTermination>true</deleteOnTermination>
</ebs>
</item>
</blockDeviceMapping>
</item>
<item>
<instanceId>i-e26cabd4</instanceId>
<imageId>ami-b8a63b88</imageId>
<instanceState>
<code>80</code>
<name>stopped</name>
</instanceState>
<privateDnsName></privateDnsName>
<dnsName></dnsName>
<stateReason>
<code>Client.UserInitiatedShutdown</code>
<message>Client.UserInitiatedShutdown: User initiated shutdown</message>
</stateReason>
<keyName>test01</keyName>
<amiLaunchIndex>1</amiLaunchIndex>
<productCodes />
<instanceType>m1.small</instanceType>
<launchTime>Wed Dec 11 05:34:17 EST 2013</launchTime>
<placement>
<availabilityZone>us-west-2a</availabilityZone>
<groupName></groupName>
<tenancy>default</tenancy>
</placement>
<kernelId>aki-6065f250</kernelId>
<ramdiskId />
<monitoring>
<state>enabled</state>
</monitoring>
<privateIpAddress />
<ipAddress />
<rootDeviceType>ebs</rootDeviceType>
<rootDeviceName>/dev/sda1</rootDeviceName>
<blockDeviceMapping>
<item>
<deviceName>/dev/sda1</deviceName>
<ebs>
<volumeId>vol-55b27b7d</volumeId>
<status>attached</status>
<attachTime>Wed Dec 11 05:34:20 EST 2013</attachTime>
<deleteOnTermination>true</deleteOnTermination>
</ebs>
</item>
</blockDeviceMapping>
</item>
</instancesSet>
</item>
</reservationSet>
</DescribeInstancesResponse>
</amazon-ec2-response>
Comments
Log in or register to comment.