amazonka-ec2-1.1.0: Amazon Elastic Compute Cloud SDK.

Copyright(c) 2013-2015 Brendan Hay
LicenseMozilla Public License, v. 2.0.
MaintainerBrendan Hay <brendan.g.hay@gmail.com>
Stabilityauto-generated
Portabilitynon-portable (GHC extensions)
Safe HaskellNone
LanguageHaskell2010

Network.AWS.EC2.RunInstances

Contents

Description

Launches the specified number of instances using an AMI for which you have permissions.

When you launch an instance, it enters the pending state. After the instance is ready for you, it enters the running state. To check the state of your instance, call DescribeInstances.

If you don't specify a security group when launching an instance, Amazon EC2 uses the default security group. For more information, see Security Groups in the Amazon Elastic Compute Cloud User Guide.

Linux instances have access to the public key of the key pair at boot. You can use this key to provide secure access to the instance. Amazon EC2 public images use this feature to provide secure access without passwords. For more information, see Key Pairs in the Amazon Elastic Compute Cloud User Guide.

You can provide optional user data when launching an instance. For more information, see Instance Metadata in the Amazon Elastic Compute Cloud User Guide.

If any of the AMIs have a product code attached for which the user has not subscribed, RunInstances fails.

T2 instance types can only be launched into a VPC. If you do not have a default VPC, or if you do not specify a subnet ID in the request, RunInstances fails.

For more information about troubleshooting, see What To Do If An Instance Immediately Terminates, and Troubleshooting Connecting to Your Instance in the Amazon Elastic Compute Cloud User Guide.

See: AWS API Reference for RunInstances.

Synopsis

Creating a Request

Request Lenses

rSecurityGroupIds :: Lens' RunInstances [Text] Source

One or more security group IDs. You can create a security group using CreateSecurityGroup.

Default: Amazon EC2 uses the default security group.

rSecurityGroups :: Lens' RunInstances [Text] Source

EC2-Classic, default VPC
One or more security group names. For a nondefault VPC, you must use security group IDs instead.

Default: Amazon EC2 uses the default security group.

rClientToken :: Lens' RunInstances (Maybe Text) Source

Unique, case-sensitive identifier you provide to ensure the idempotency of the request. For more information, see Ensuring Idempotency.

Constraints: Maximum 64 ASCII characters

rDisableAPITermination :: Lens' RunInstances (Maybe Bool) Source

If you set this parameter to true, you can't terminate the instance using the Amazon EC2 console, CLI, or API; otherwise, you can. If you set this parameter to true and then later want to be able to terminate the instance, you must first change the value of the disableApiTermination attribute to false using ModifyInstanceAttribute. Alternatively, if you set InstanceInitiatedShutdownBehavior to terminate, you can terminate the instance by running the shutdown command from the instance.

Default: false

rKeyName :: Lens' RunInstances (Maybe Text) Source

The name of the key pair. You can create a key pair using CreateKeyPair or ImportKeyPair.

If you do not specify a key pair, you can't connect to the instance unless you choose an AMI that is configured to allow users another way to log in.

rRAMDiskId :: Lens' RunInstances (Maybe Text) Source

The ID of the RAM disk.

We recommend that you use PV-GRUB instead of kernels and RAM disks. For more information, see PV-GRUB in the Amazon Elastic Compute Cloud User Guide.

rKernelId :: Lens' RunInstances (Maybe Text) Source

The ID of the kernel.

We recommend that you use PV-GRUB instead of kernels and RAM disks. For more information, see PV-GRUB in the Amazon Elastic Compute Cloud User Guide.

rSubnetId :: Lens' RunInstances (Maybe Text) Source

EC2-VPC
The ID of the subnet to launch the instance into.

rInstanceType :: Lens' RunInstances (Maybe InstanceType) Source

The instance type. For more information, see Instance Types in the Amazon Elastic Compute Cloud User Guide.

Default: 'm1.small'

rEBSOptimized :: Lens' RunInstances (Maybe Bool) Source

Indicates whether the instance is optimized for EBS I/O. This optimization provides dedicated throughput to Amazon EBS and an optimized configuration stack to provide optimal EBS I/O performance. This optimization isn't available with all instance types. Additional usage charges apply when using an EBS-optimized instance.

Default: false

rUserData :: Lens' RunInstances (Maybe Text) Source

The Base64-encoded MIME user data for the instances.

rInstanceInitiatedShutdownBehavior :: Lens' RunInstances (Maybe ShutdownBehavior) Source

Indicates whether an instance stops or terminates when you initiate shutdown from the instance (using the operating system command for system shutdown).

Default: stop

rPrivateIPAddress :: Lens' RunInstances (Maybe Text) Source

EC2-VPC
The primary IP address. You must specify a value from the IP address range of the subnet.

Only one private IP address can be designated as primary. Therefore, you can't specify this parameter if 'PrivateIpAddresses.n.Primary' is set to true and 'PrivateIpAddresses.n.PrivateIpAddress' is set to an IP address.

Default: We select an IP address from the IP address range of the subnet.

rDryRun :: Lens' RunInstances (Maybe Bool) Source

Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

rPlacement :: Lens' RunInstances (Maybe Placement) Source

The placement for the instance.

rImageId :: Lens' RunInstances Text Source

The ID of the AMI, which you can get by calling DescribeImages.

rMinCount :: Lens' RunInstances Int Source

The minimum number of instances to launch. If you specify a minimum that is more instances than Amazon EC2 can launch in the target Availability Zone, Amazon EC2 launches no instances.

Constraints: Between 1 and the maximum number you're allowed for the specified instance type. For more information about the default limits, and how to request an increase, see How many instances can I run in Amazon EC2 in the Amazon EC2 General FAQ.

rMaxCount :: Lens' RunInstances Int Source

The maximum number of instances to launch. If you specify more instances than Amazon EC2 can launch in the target Availability Zone, Amazon EC2 launches the largest possible number of instances above MinCount.

Constraints: Between 1 and the maximum number you're allowed for the specified instance type. For more information about the default limits, and how to request an increase, see How many instances can I run in Amazon EC2 in the Amazon EC2 General FAQ.

Destructuring the Response

reservation Source

Creates a value of Reservation with the minimum fields required to make a request.

Use one of the following lenses to modify other fields as desired:

Response Lenses

rGroups :: Lens' Reservation [GroupIdentifier] Source

One or more security groups.

rInstances :: Lens' Reservation [Instance] Source

One or more instances.

rRequesterId :: Lens' Reservation (Maybe Text) Source

The ID of the requester that launched the instances on your behalf (for example, AWS Management Console or Auto Scaling).

rReservationId :: Lens' Reservation Text Source

The ID of the reservation.

rOwnerId :: Lens' Reservation Text Source

The ID of the AWS account that owns the reservation.