Skip to content
This repository has been archived by the owner on Jul 15, 2019. It is now read-only.

RunInstances

harlowja edited this page Apr 11, 2012 · 55 revisions

RunInstances

Method information

Request

Type: GET/POST

Uri: http://$HOST:$PORT/$PATH/

Notes: Performed using euca-run-instances using euca2ools_2.0.0~bzr464-0ubuntu2 on Ubuntu 11.10

Params:

AWSAccessKeyId=<VARIABLE>&Action=RunInstances&ImageId=<VARIABLE>&InstanceType=<VARIABLE>&MaxCount=<VARIABLE>&MinCount=<VARIABLE>&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=<VARIABLE>&Version=2009-11-30

  1. MaxCount can be >= MinCount (is there any validation on this?)
  2. ImageId must be an existent and accessible image identifier
  3. InstanceType must be an existent and accessible flavor

Exact version requested: 2009-11-30

Restricted to: projectmanager, sysadmin

Docs

  1. http://docs.amazonwebservices.com/AWSEC2/2009-11-30/APIReference/index.html?ApiReference-query-RunInstances.html

XSD

  1. https://github.com/yahoo/Openstack-EC2/blob/master/data/xsds/2009-11-30.ec2.wsdl.xsd#L137

Expected response

An XML response (with status code 200) conforming to the previous XSD would be expected.

Actual response

<?xml version="1.0" ?>
<RunInstancesResponse xmlns="http://ec2.amazonaws.com/doc/2009-11-30/">
   <requestId>req-5125b273-4a29-4db3-9d8a-0e743a716ceb</requestId>
   <ownerId>78560ada18d4443e8ef514428f45e1cb</ownerId>
   <groupSet>
      <item>
         <groupId>default</groupId>
      </item>
   </groupSet>
   <reservationId>r-6l74vh0p</reservationId>
   <instancesSet>
      <item>
         <placement>
            <availabilityZone>unknown zone</availabilityZone>
         </placement>
         <rootDeviceType>instance-store</rootDeviceType>
         <keyName/>
         <instanceId>i-00000001</instanceId>
         <instanceState>
            <code>0</code>
            <name>pending</name>
         </instanceState>
         <publicDnsName/>
         <imageId>ami-00000003</imageId>
         <productCodesSet/>
         <privateDnsName>server-1</privateDnsName>
         <dnsName>server-1</dnsName>
         <launchTime>2012-04-10T18:04:15.000Z</launchTime>
         <amiLaunchIndex>0</amiLaunchIndex>
         <rootDeviceName>/dev/sda1</rootDeviceName>
         <kernelId>aki-00000001</kernelId>
         <ramdiskId>ari-00000002</ramdiskId>
         <ipAddress/>
         <instanceType>m1.small</instanceType>
         <privateIpAddress/>
      </item>
   </instancesSet>
</RunInstancesResponse>

Errors

An error will be sent back in the following XML format (with a 400 status code):

<?xml version="1.0"?>
<Response>
   <Errors>
      <Error>
         <Code>%s</Code>
         <Message>%s</Message>
      </Error>
   </Errors>
   <RequestID>%s</RequestID>
</Response>

Codes

  1. EC2APIError
  2. ImageNotFound
  3. InstanceLimitExceeded
  4. InstanceTypeDiskTooSmall
  5. InstanceTypeMemoryTooSmall
  6. InstanceTypeNotFoundByName
  7. InvalidInstanceIDMalformed
  8. InvalidParameterValue
  9. InvalidRequest
  10. NotAuthorized
  11. QuotaError
  12. SecurityGroupNotFound
  13. SecurityGroupNotFoundForProject
  14. Unauthorized (huh, duplicate of NotAuthorized?)
  15. UnknownError
  16. (Others??)

Issues

  1. Does not comply to defined schema (ordering mainly)

$ xsd-validate.sh ../data/xsds/2009-11-30.ec2.wsdl.xsd ../req.xml

org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid content was found starting with element 'ownerId'. One of '{"http://ec2.amazonaws.com/doc/2009-11-30/":reservationId}' is expected.
org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid content was found starting with element 'placement'. One of '{"http://ec2.amazonaws.com/doc/2009-11-30/":instanceId}' is expected.
  1. Version support is weak/non-existent; code copies input version parameter and echos it back
  1. No validation on input of the given version
  2. No validation of the output
  • Does not ensure it conforms to a given version
  • No concept of separate renderers for all supported versions
  1. launchTime is not compliant with the expected xs:dateTime format
  2. Request parameters not implemented
  • Monitoring.Enabled
  • AddressingType
  • SubnetId
  • DisableApiTermination
  • InstanceInitiatedShutdownBehavior
  1. Non-compliant request parameters
  • KeyName (?)
  • UserData (post data?)
  1. Weak to non-existent list of error messages which can be returned
  2. Mapping to EC2 error codes is incorrect
  1. Little parameter validation (ie all args are converted into python uncamelcased objects/lists)
  • This could lead to exploits/DOS/python running out of memory...
  1. Error XML response creation does not do XML escaping, see LP bug #978439
Clone this wiki locally