How to Run an Instance
This section describes how to run an instance.
How To
To launch an instance
-
If you are using SOAP, construct the following request:
<RunInstances xmlns="http://ec2.amazonaws.com/doc/2009-10-31/"> <imageId>ami-235fba4a</imageId> <minCount>1</minCount> <maxCount>1</maxCount> <keyName>gsg-keypair</keyName> <groupSet/> <placement> <availabilityZone>us-east-1a</availabilityZone> </placement> </RunInstances>
-
If you are using Query, construct the following request:
https://ec2.amazonaws.com/ ?Action=RunInstances &ImageId=ami-235fba4a &MaxCount=1 &MinCount=1 &KeyName=gsg-keypair &Placement.AvailabilityZone=us-east-1a &...auth parameters...
-
View output similar to the following:
<RunInstancesResponse xmlns="http://ec2.amazonaws.com/doc/2009-10-31/"> <reservationId>r-47a5402e</reservationId> <ownerId>AIDADH4IGTRXXKCD</ownerId> <groupSet> <item> <groupId>default</groupId> </item> </groupSet> <instancesSet> <item> <instanceId>i-2ba64342</instanceId> <imageId>ami-235fba4a</imageId> <instanceState> <code>0</code> <name>pending</name> </instanceState> <privateDnsName></privateDnsName> <dnsName></dnsName> <keyName>gsg-keypair</keyName> <amiLaunchIndex>0</amiLaunchIndex> <instanceType>m1.small</instanceType> <launchTime>2007-08-07T11:51:50.000Z</launchTime> <placement> <availabilityZone>us-east-1a</availabilityZone> </placement> <monitoring> <enabled>false</enabled> </monitoring> </item> </instancesSet> </RunInstancesResponse>
To view the status of a launched instance
-
If you are using SOAP, construct the following request:
<DescribeInstances xmlns="http://ec2.amazonaws.com/doc/2009-10-31/"> <instancesSet> <item> <instanceId>i-2ba64342</instanceId> </item> </instancesSet> </DescribeInstances>
-
If you are using Query, construct the following request:
https://ec2.amazonaws.com/ ?Action=DescribeInstances &InstanceId=i-2ba64342 &...auth parameters...
-
View output similar to the following:
<DescribeInstancesResponse xmlns="http://ec2.amazonaws.com/doc/2009-10-31/"> <reservationId>r-47a5402e</reservationId> <ownerId>AIDADH4IGTRXXKCD</ownerId> <groupSet> <item> <groupId>default</groupId> </item> </groupSet> <instancesSet> <item> <instanceId>i-2ba64342</instanceId> <imageId>ami-235fba4a</imageId> <instanceState> <code>0</code> <name>running</name> </instanceState> <privateDnsName></privateDnsName> <dnsName></dnsName> <keyName>gsg-keypair</keyName> <amiLaunchIndex>0</amiLaunchIndex> <instanceType>m1.small</instanceType> <launchTime>2007-08-07T11:51:50.000Z</launchTime> <placement> <availabilityZone>us-east-1a</availabilityZone> </placement> <monitoring> <enabled>false</enabled> </monitoring> </item> </instancesSet> </DescribeInstancesResponse>