RunInstances
The RunInstances
operation launches a
specified number of instances.
Note | |
---|---|
The Query version of |
A call to RunInstances
is guaranteed to start
no fewer than the requested minimum. If there is insufficient
capacity available then no instances will be started. Amazon EC2 will
make a best effort attempt to satisfy the requested maximum
values.
Every instance is launched in a security group. This may be specified as part of the launch request. If a security group is not indicated then instances are started in a the default security group.
An optional keypair ID may be provided for each image in the launch request. All instances that are created from images for which this is provided will have access to the associated public key at boot time (detailed below). This key may be used to provide secure access to an instance of an image on a per-instance basis. Amazon EC2 public images make use of this functionality to provide secure passwordless access to instances (and launching those images without a keypair ID will leave them inaccessible).
The public key material is made available to the instance at boot
time by placing it in a file named
openssh_id.pub
on a logical device that is
exposed to the instance as /dev/sda2
(the
ephemeral store). The format of this file is suitable for use as
an entry within ~/.ssh/authorized_keys
(the
OpenSSH format). This can be done at boot time (as part of
rclocal
, for example) allowing for secure
password-less access. As the need arises, other formats will also
be considered.
If the AMI has a product code attached for which the user has not
subscribed, the
RunInstances
call will fail.
The following table describes the request parameters for
RunInstances
. Parameter names are case
sensitive.
Element Name | Definition | Required? | Type |
---|---|---|---|
ImageId
|
Id of the AMI to launch instances based on. | Yes |
string
|
MinCount
|
Minimum number of instances to launch. | Yes |
int
|
MaxCount
|
Maximum number of instances to launch. | Yes |
int
|
KeyName
|
Name of the keypair to launch instances with. | No |
string
|
SecurityGroup. n
|
Names of the security groups to associate the instances with. | No |
string
|
UserData
|
The user data available to the launched instances. This
should be base64-encoded. See the UserDataType
data type for encoding details.
|
No |
string
|
AddressingType
|
The addressing scheme to launch the instance with. The addressing type can be direct or public. In the direct scheme the instance has one IP address that is not NATted. For the public scheme the instance has a NATted IP address. See the section called “Instance Addressing” for more information on instance addressing. | No |
string
|
The following table describes the default response tags included
in RunInstances
responses.
Element Name | Definition | Type |
---|---|---|
RunInstancesResponse
|
Status information about the instances started. |
ec2ReservationInfoType
|
https://ec2.amazonaws.com/ ?Action=RunInstances &ImageId=ami-60a54009 &MaxCount=3 &MinCount=1 &AddressingType=public &...auth parameters...
<RunInstancesResponse xmlns="http://ec2.amazonaws.com/doc/2007-01-03"> <reservationId>r-47a5402e</reservationId> <ownerId>495219933132</ownerId> <groupSet> <item> <groupId>default</groupId> </item> </groupSet> <instancesSet> <item> <instanceId>i-2ba64342</instanceId> <imageId>ami-60a54009</imageId> <instanceState> <code>0</code> <name>pending</name> </instanceState> <privateDnsName></privateDnsName> <dnsName></dnsName> <keyName>example-key-name</keyName> </item> <item> <instanceId>i-2bc64242</instanceId> <imageId>ami-60a54009</imageId> <instanceState> <code>0</code> <name>pending</name> </instanceState> <privateDnsName></privateDnsName> <dnsName></dnsName> <keyName>example-key-name</keyName> </item> <item> <instanceId>i-2be64332</instanceId> <imageId>ami-60a54009</imageId> <instanceState> <code>0</code> <name>pending</name> </instanceState> <privateDnsName></privateDnsName> <dnsName></dnsName> <keyName>example-key-name</keyName> </item> </instancesSet> </RunInstancesResponse>