Copyright | (c) 2013-2016 Brendan Hay |
---|---|
License | Mozilla Public License, v. 2.0. |
Maintainer | Brendan Hay <brendan.g.hay@gmail.com> |
Stability | auto-generated |
Portability | non-portable (GHC extensions) |
Safe Haskell | None |
Language | Haskell2010 |
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.
To ensure faster instance launches, break up large requests into smaller batches. For example, create five separate launch requests for 100 instances each instead of one launch request for 500 instances.
To tag your instance, ensure that it is running
as CreateTags requires a resource ID. For more information about tagging, see Tagging Your Amazon EC2 Resources.
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.
- EC2-VPC only accounts
- If you don't specify a subnet in the request, we choose a default subnet from your default VPC for you.
- EC2-Classic accounts
- If you're launching into EC2-Classic and you don't specify an Availability Zone, we choose one for you.
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.
Some 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, see Instance Types Available Only in a VPC.
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.
- runInstances :: Text -> Int -> Int -> RunInstances
- data RunInstances
- rAdditionalInfo :: Lens' RunInstances (Maybe Text)
- rSecurityGroupIds :: Lens' RunInstances [Text]
- rSecurityGroups :: Lens' RunInstances [Text]
- rClientToken :: Lens' RunInstances (Maybe Text)
- rDisableAPITermination :: Lens' RunInstances (Maybe Bool)
- rKeyName :: Lens' RunInstances (Maybe Text)
- rNetworkInterfaces :: Lens' RunInstances [InstanceNetworkInterfaceSpecification]
- rRAMDiskId :: Lens' RunInstances (Maybe Text)
- rSubnetId :: Lens' RunInstances (Maybe Text)
- rKernelId :: Lens' RunInstances (Maybe Text)
- rInstanceType :: Lens' RunInstances (Maybe InstanceType)
- rEBSOptimized :: Lens' RunInstances (Maybe Bool)
- rUserData :: Lens' RunInstances (Maybe Text)
- rMonitoring :: Lens' RunInstances (Maybe RunInstancesMonitoringEnabled)
- rIAMInstanceProfile :: Lens' RunInstances (Maybe IAMInstanceProfileSpecification)
- rPrivateIPAddress :: Lens' RunInstances (Maybe Text)
- rInstanceInitiatedShutdownBehavior :: Lens' RunInstances (Maybe ShutdownBehavior)
- rBlockDeviceMappings :: Lens' RunInstances [BlockDeviceMapping]
- rDryRun :: Lens' RunInstances (Maybe Bool)
- rPlacement :: Lens' RunInstances (Maybe Placement)
- rImageId :: Lens' RunInstances Text
- rMinCount :: Lens' RunInstances Int
- rMaxCount :: Lens' RunInstances Int
- reservation :: Text -> Text -> Reservation
- data Reservation
- rGroups :: Lens' Reservation [GroupIdentifier]
- rInstances :: Lens' Reservation [Instance]
- rRequesterId :: Lens' Reservation (Maybe Text)
- rReservationId :: Lens' Reservation Text
- rOwnerId :: Lens' Reservation Text
Creating a Request
Creates a value of RunInstances
with the minimum fields required to make a request.
Use one of the following lenses to modify other fields as desired:
rAdditionalInfo
rSecurityGroupIds
rSecurityGroups
rClientToken
rDisableAPITermination
rKeyName
rNetworkInterfaces
rRAMDiskId
rSubnetId
rKernelId
rInstanceType
rEBSOptimized
rUserData
rMonitoring
rIAMInstanceProfile
rPrivateIPAddress
rInstanceInitiatedShutdownBehavior
rBlockDeviceMappings
rDryRun
rPlacement
rImageId
rMinCount
rMaxCount
data RunInstances Source #
Contains the parameters for RunInstances.
See: runInstances
smart constructor.
Request Lenses
rAdditionalInfo :: Lens' RunInstances (Maybe Text) Source #
Reserved.
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.
rNetworkInterfaces :: Lens' RunInstances [InstanceNetworkInterfaceSpecification] Source #
One or more network interfaces.
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.
rSubnetId :: Lens' RunInstances (Maybe Text) Source #
- EC2-VPC
- The ID of the subnet to launch the instance into.
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.
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 user data to make available to the instance. For more information, see Running Commands on Your Linux Instance at Launch (Linux) and Adding User Data (Windows). If you are using an AWS SDK or command line tool, Base64-encoding is performed for you, and you can load the text from a file. Otherwise, you must provide Base64-encoded text.
rMonitoring :: Lens' RunInstances (Maybe RunInstancesMonitoringEnabled) Source #
The monitoring for the instance.
rIAMInstanceProfile :: Lens' RunInstances (Maybe IAMInstanceProfileSpecification) Source #
The IAM instance profile.
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.
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
rBlockDeviceMappings :: Lens' RunInstances [BlockDeviceMapping] Source #
The block device mapping.
Supplying both a snapshot ID and an encryption value as arguments for block-device mapping results in an error. This is because only blank volumes can be encrypted on start, and these are not created from a snapshot. If a snapshot is the basis for the volume, it contains data by definition and its encryption status cannot be changed using this action.
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 FAQ.
Destructuring the Response
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:
data Reservation Source #
Describes a reservation.
See: reservation
smart constructor.
Response Lenses
rGroups :: Lens' Reservation [GroupIdentifier] Source #
- EC2-Classic only
- 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.