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

Copyright(c) 2013-2016 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.

You can specify a number of options, or leave the default options. The following rules apply:

  • [EC2-VPC] If you don't specify a subnet ID, we choose a default subnet from your default VPC for you. If you don't have a default VPC, you must specify a subnet ID in the request.
  • [EC2-Classic] If don't specify an Availability Zone, we choose one for you.
  • Some instance types must be launched into a VPC. If you do not have a default VPC, or if you do not specify a subnet ID, the request fails. For more information, see Instance Types Available Only in a VPC .
  • [EC2-VPC] All instances have a network interface with a primary private IPv4 address. If you don't specify this address, we choose one from the IPv4 range of your subnet.
  • Not all instance types support IPv6 addresses. For more information, see Amazon EC2 Instance Types .
  • If you don't specify a security group ID, we use the default security group. For more information, see Security Groups .
  • If any of the AMIs have a product code attached for which the user has not subscribed, the request fails.

To ensure faster instance launches, break up large requests into smaller batches. For example, create 5 separate launch requests for 100 instances each instead of 1 launch request for 500 instances.

An instance is ready for you to use when it's in the running state. You can check the state of your instance using DescribeInstances . After launch, you can apply tags to your running instance (requires a resource ID). For more information, see CreateTags and Tagging Your Amazon EC2 Resources .

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 .

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

Synopsis

Creating a Request

runInstances Source #

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 - Reserved.
  • rSecurityGroupIds - One or more security group IDs. You can create a security group using CreateSecurityGroup . Default: Amazon EC2 uses the default security group.
  • rSecurityGroups - [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 - 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 - If you set this parameter to true , you can't terminate the instance using the Amazon EC2 console, CLI, or API; otherwise, you can. To change this attribute to false after launch, use ModifyInstanceAttribute . Alternatively, if you set InstanceInitiatedShutdownBehavior to terminate , you can terminate the instance by running the shutdown command from the instance. Default: false
  • rKeyName - The name of the key pair. You can create a key pair using CreateKeyPair or ImportKeyPair . Important: 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 - One or more network interfaces.
  • rRAMDiskId - The ID of the RAM disk. Important: 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 - [EC2-VPC] The ID of the subnet to launch the instance into.
  • rKernelId - The ID of the kernel. Important: 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 - The instance type. For more information, see Instance Types in the Amazon Elastic Compute Cloud User Guide . Default: m1.small
  • rEBSOptimized - Indicates whether the instance is optimized for EBS IO. This optimization provides dedicated throughput to Amazon EBS and an optimized configuration stack to provide optimal EBS IO performance. This optimization isn't available with all instance types. Additional usage charges apply when using an EBS-optimized instance. Default: false
  • rUserData - 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 - The monitoring for the instance.
  • rIPv6AddressCount - [EC2-VPC] A number of IPv6 addresses to associate with the primary network interface. Amazon EC2 chooses the IPv6 addresses from the range of your subnet. You cannot specify this option and the option to assign specific IPv6 addresses in the same request. You can specify this option if you've specified a minimum number of instances to launch.
  • rIAMInstanceProfile - The IAM instance profile.
  • rPrivateIPAddress - [EC2-VPC] The primary IPv4 address. You must specify a value from the IPv4 address range of the subnet. Only one private IP address can be designated as primary. You can't specify this option if you've specified the option to designate a private IP address as the primary IP address in a network interface specification. You cannot specify this option if you're launching more than one instance in the request.
  • rInstanceInitiatedShutdownBehavior - 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 - The block device mapping. Important: 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 - 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 - The placement for the instance.
  • rIPv6Addresses - [EC2-VPC] Specify one or more IPv6 addresses from the range of the subnet to associate with the primary network interface. You cannot specify this option and the option to assign a number of IPv6 addresses in the same request. You cannot specify this option if you've specified a minimum number of instances to launch.
  • rImageId - The ID of the AMI, which you can get by calling DescribeImages .
  • rMinCount - 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 - 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.

data RunInstances Source #

Contains the parameters for RunInstances.

See: runInstances smart constructor.

Instances

Eq RunInstances Source # 
Data RunInstances Source # 

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> RunInstances -> c RunInstances #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c RunInstances #

toConstr :: RunInstances -> Constr #

dataTypeOf :: RunInstances -> DataType #

dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c RunInstances) #

dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c RunInstances) #

gmapT :: (forall b. Data b => b -> b) -> RunInstances -> RunInstances #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> RunInstances -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> RunInstances -> r #

gmapQ :: (forall d. Data d => d -> u) -> RunInstances -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> RunInstances -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> RunInstances -> m RunInstances #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> RunInstances -> m RunInstances #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> RunInstances -> m RunInstances #

Read RunInstances Source # 
Show RunInstances Source # 
Generic RunInstances Source # 

Associated Types

type Rep RunInstances :: * -> * #

Hashable RunInstances Source # 
NFData RunInstances Source # 

Methods

rnf :: RunInstances -> () #

AWSRequest RunInstances Source # 
ToPath RunInstances Source # 
ToHeaders RunInstances Source # 
ToQuery RunInstances Source # 
type Rep RunInstances Source # 
type Rep RunInstances = D1 (MetaData "RunInstances" "Network.AWS.EC2.RunInstances" "amazonka-ec2-1.4.5-4J1X1aohvSR7xjHvMmTrf6" False) (C1 (MetaCons "RunInstances'" PrefixI True) ((:*:) ((:*:) ((:*:) ((:*:) (S1 (MetaSel (Just Symbol "_rAdditionalInfo") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (Maybe Text))) ((:*:) (S1 (MetaSel (Just Symbol "_rSecurityGroupIds") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (Maybe [Text]))) (S1 (MetaSel (Just Symbol "_rSecurityGroups") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (Maybe [Text]))))) ((:*:) (S1 (MetaSel (Just Symbol "_rClientToken") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (Maybe Text))) ((:*:) (S1 (MetaSel (Just Symbol "_rDisableAPITermination") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (Maybe Bool))) (S1 (MetaSel (Just Symbol "_rKeyName") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (Maybe Text)))))) ((:*:) ((:*:) (S1 (MetaSel (Just Symbol "_rNetworkInterfaces") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (Maybe [InstanceNetworkInterfaceSpecification]))) ((:*:) (S1 (MetaSel (Just Symbol "_rRAMDiskId") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (Maybe Text))) (S1 (MetaSel (Just Symbol "_rSubnetId") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (Maybe Text))))) ((:*:) (S1 (MetaSel (Just Symbol "_rKernelId") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (Maybe Text))) ((:*:) (S1 (MetaSel (Just Symbol "_rInstanceType") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (Maybe InstanceType))) (S1 (MetaSel (Just Symbol "_rEBSOptimized") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (Maybe Bool))))))) ((:*:) ((:*:) ((:*:) (S1 (MetaSel (Just Symbol "_rUserData") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (Maybe Text))) ((:*:) (S1 (MetaSel (Just Symbol "_rMonitoring") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (Maybe RunInstancesMonitoringEnabled))) (S1 (MetaSel (Just Symbol "_rIPv6AddressCount") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (Maybe Int))))) ((:*:) (S1 (MetaSel (Just Symbol "_rIAMInstanceProfile") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (Maybe IAMInstanceProfileSpecification))) ((:*:) (S1 (MetaSel (Just Symbol "_rPrivateIPAddress") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (Maybe Text))) (S1 (MetaSel (Just Symbol "_rInstanceInitiatedShutdownBehavior") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (Maybe ShutdownBehavior)))))) ((:*:) ((:*:) (S1 (MetaSel (Just Symbol "_rBlockDeviceMappings") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (Maybe [BlockDeviceMapping]))) ((:*:) (S1 (MetaSel (Just Symbol "_rDryRun") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (Maybe Bool))) (S1 (MetaSel (Just Symbol "_rPlacement") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (Maybe Placement))))) ((:*:) ((:*:) (S1 (MetaSel (Just Symbol "_rIPv6Addresses") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (Maybe [InstanceIPv6Address]))) (S1 (MetaSel (Just Symbol "_rImageId") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Text))) ((:*:) (S1 (MetaSel (Just Symbol "_rMinCount") NoSourceUnpackedness SourceStrict DecidedUnpack) (Rec0 Int)) (S1 (MetaSel (Just Symbol "_rMaxCount") NoSourceUnpackedness SourceStrict DecidedUnpack) (Rec0 Int))))))))
type Rs RunInstances Source # 

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. To change this attribute to false after launch, use 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 . Important: 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. Important: 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. Important: 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 IO. This optimization provides dedicated throughput to Amazon EBS and an optimized configuration stack to provide optimal EBS IO 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.

rIPv6AddressCount :: Lens' RunInstances (Maybe Int) Source #

EC2-VPC
A number of IPv6 addresses to associate with the primary network interface. Amazon EC2 chooses the IPv6 addresses from the range of your subnet. You cannot specify this option and the option to assign specific IPv6 addresses in the same request. You can specify this option if you've specified a minimum number of instances to launch.

rPrivateIPAddress :: Lens' RunInstances (Maybe Text) Source #

EC2-VPC
The primary IPv4 address. You must specify a value from the IPv4 address range of the subnet. Only one private IP address can be designated as primary. You can't specify this option if you've specified the option to designate a private IP address as the primary IP address in a network interface specification. You cannot specify this option if you're launching more than one instance in the request.

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. Important: 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.

rIPv6Addresses :: Lens' RunInstances [InstanceIPv6Address] Source #

EC2-VPC
Specify one or more IPv6 addresses from the range of the subnet to associate with the primary network interface. You cannot specify this option and the option to assign a number of IPv6 addresses in the same request. You cannot specify this option if you've specified a minimum number of instances to launch.

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

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:

  • rGroups - [EC2-Classic only] One or more security groups.
  • rInstances - One or more instances.
  • rRequesterId - The ID of the requester that launched the instances on your behalf (for example, AWS Management Console or Auto Scaling).
  • rReservationId - The ID of the reservation.
  • rOwnerId - The ID of the AWS account that owns the reservation.

data Reservation Source #

Describes a reservation.

See: reservation smart constructor.

Instances

Eq Reservation Source # 
Data Reservation Source # 

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Reservation -> c Reservation #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Reservation #

toConstr :: Reservation -> Constr #

dataTypeOf :: Reservation -> DataType #

dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c Reservation) #

dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Reservation) #

gmapT :: (forall b. Data b => b -> b) -> Reservation -> Reservation #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Reservation -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Reservation -> r #

gmapQ :: (forall d. Data d => d -> u) -> Reservation -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Reservation -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Reservation -> m Reservation #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Reservation -> m Reservation #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Reservation -> m Reservation #

Read Reservation Source # 
Show Reservation Source # 
Generic Reservation Source # 

Associated Types

type Rep Reservation :: * -> * #

Hashable Reservation Source # 
NFData Reservation Source # 

Methods

rnf :: Reservation -> () #

FromXML Reservation Source # 
type Rep Reservation Source # 
type Rep Reservation = D1 (MetaData "Reservation" "Network.AWS.EC2.Types.Product" "amazonka-ec2-1.4.5-4J1X1aohvSR7xjHvMmTrf6" False) (C1 (MetaCons "Reservation'" PrefixI True) ((:*:) ((:*:) (S1 (MetaSel (Just Symbol "_rGroups") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (Maybe [GroupIdentifier]))) (S1 (MetaSel (Just Symbol "_rInstances") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (Maybe [Instance])))) ((:*:) (S1 (MetaSel (Just Symbol "_rRequesterId") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (Maybe Text))) ((:*:) (S1 (MetaSel (Just Symbol "_rReservationId") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Text)) (S1 (MetaSel (Just Symbol "_rOwnerId") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Text))))))

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.

rOwnerId :: Lens' Reservation Text Source #

The ID of the AWS account that owns the reservation.