{-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE TypeFamilies #-} {-# OPTIONS_GHC -fno-warn-unused-imports #-} {-# OPTIONS_GHC -fno-warn-unused-binds #-} {-# OPTIONS_GHC -fno-warn-unused-matches #-} -- Derived from AWS service descriptions, licensed under Apache 2.0. -- | -- Module : Network.AWS.AutoScaling.CreateLaunchConfiguration -- Copyright : (c) 2013-2016 Brendan Hay -- License : Mozilla Public License, v. 2.0. -- Maintainer : Brendan Hay -- Stability : auto-generated -- Portability : non-portable (GHC extensions) -- -- Creates a launch configuration. -- -- -- If you exceed your maximum limit of launch configurations, which by default is 100 per region, the call fails. For information about viewing and updating this limit, see 'DescribeAccountLimits' . -- -- For more information, see in the /Auto Scaling User Guide/ . -- module Network.AWS.AutoScaling.CreateLaunchConfiguration ( -- * Creating a Request createLaunchConfiguration , CreateLaunchConfiguration -- * Request Lenses , clcInstanceId , clcAssociatePublicIPAddress , clcSecurityGroups , clcSpotPrice , clcInstanceMonitoring , clcKeyName , clcClassicLinkVPCSecurityGroups , clcRAMDiskId , clcKernelId , clcInstanceType , clcEBSOptimized , clcUserData , clcClassicLinkVPCId , clcIAMInstanceProfile , clcImageId , clcPlacementTenancy , clcBlockDeviceMappings , clcLaunchConfigurationName -- * Destructuring the Response , createLaunchConfigurationResponse , CreateLaunchConfigurationResponse ) where import Network.AWS.AutoScaling.Types import Network.AWS.AutoScaling.Types.Product import Network.AWS.Lens import Network.AWS.Prelude import Network.AWS.Request import Network.AWS.Response -- | Contains the parameters for CreateLaunchConfiguration. -- -- -- -- /See:/ 'createLaunchConfiguration' smart constructor. data CreateLaunchConfiguration = CreateLaunchConfiguration' { _clcInstanceId :: !(Maybe Text) , _clcAssociatePublicIPAddress :: !(Maybe Bool) , _clcSecurityGroups :: !(Maybe [Text]) , _clcSpotPrice :: !(Maybe Text) , _clcInstanceMonitoring :: !(Maybe InstanceMonitoring) , _clcKeyName :: !(Maybe Text) , _clcClassicLinkVPCSecurityGroups :: !(Maybe [Text]) , _clcRAMDiskId :: !(Maybe Text) , _clcKernelId :: !(Maybe Text) , _clcInstanceType :: !(Maybe Text) , _clcEBSOptimized :: !(Maybe Bool) , _clcUserData :: !(Maybe Text) , _clcClassicLinkVPCId :: !(Maybe Text) , _clcIAMInstanceProfile :: !(Maybe Text) , _clcImageId :: !(Maybe Text) , _clcPlacementTenancy :: !(Maybe Text) , _clcBlockDeviceMappings :: !(Maybe [BlockDeviceMapping]) , _clcLaunchConfigurationName :: !Text } deriving (Eq,Read,Show,Data,Typeable,Generic) -- | Creates a value of 'CreateLaunchConfiguration' with the minimum fields required to make a request. -- -- Use one of the following lenses to modify other fields as desired: -- -- * 'clcInstanceId' - The ID of the instance to use to create the launch configuration. The new launch configuration derives attributes from the instance, with the exception of the block device mapping. To create a launch configuration with a block device mapping or override any other instance attributes, specify them as part of the same request. For more information, see in the /Auto Scaling User Guide/ . -- -- * 'clcAssociatePublicIPAddress' - Used for groups that launch instances into a virtual private cloud (VPC). Specifies whether to assign a public IP address to each instance. For more information, see in the /Auto Scaling User Guide/ . If you specify this parameter, be sure to specify at least one subnet when you create your group. Default: If the instance is launched into a default subnet, the default is @true@ . If the instance is launched into a nondefault subnet, the default is @false@ . For more information, see in the /Amazon Elastic Compute Cloud User Guide/ . -- -- * 'clcSecurityGroups' - One or more security groups with which to associate the instances. If your instances are launched in EC2-Classic, you can either specify security group names or the security group IDs. For more information about security groups for EC2-Classic, see in the /Amazon Elastic Compute Cloud User Guide/ . If your instances are launched into a VPC, specify security group IDs. For more information, see in the /Amazon Virtual Private Cloud User Guide/ . -- -- * 'clcSpotPrice' - The maximum hourly price to be paid for any Spot Instance launched to fulfill the request. Spot Instances are launched when the price you specify exceeds the current Spot market price. For more information, see in the /Auto Scaling User Guide/ . -- -- * 'clcInstanceMonitoring' - Enables detailed monitoring (@true@ ) or basic monitoring (@false@ ) for the Auto Scaling instances. -- -- * 'clcKeyName' - The name of the key pair. For more information, see in the /Amazon Elastic Compute Cloud User Guide/ . -- -- * 'clcClassicLinkVPCSecurityGroups' - The IDs of one or more security groups for the specified ClassicLink-enabled VPC. This parameter is required if you specify a ClassicLink-enabled VPC, and is not supported otherwise. For more information, see in the /Amazon Elastic Compute Cloud User Guide/ . -- -- * 'clcRAMDiskId' - The ID of the RAM disk associated with the AMI. -- -- * 'clcKernelId' - The ID of the kernel associated with the AMI. -- -- * 'clcInstanceType' - The instance type of the EC2 instance. For information about available instance types, see in the /Amazon Elastic Compute Cloud User Guide./ -- -- * 'clcEBSOptimized' - Indicates whether the instance is optimized for Amazon EBS I/O. By default, the instance is not optimized for EBS I/O. The optimization provides dedicated throughput to Amazon EBS and an optimized configuration stack to provide optimal I/O performance. This optimization is not available with all instance types. Additional usage charges apply. For more information, see in the /Amazon Elastic Compute Cloud User Guide/ . -- -- * 'clcUserData' - The user data to make available to the launched EC2 instances. For more information, see in the /Amazon Elastic Compute Cloud User Guide/ . -- -- * 'clcClassicLinkVPCId' - The ID of a ClassicLink-enabled VPC to link your EC2-Classic instances to. This parameter is supported only if you are launching EC2-Classic instances. For more information, see in the /Amazon Elastic Compute Cloud User Guide/ . -- -- * 'clcIAMInstanceProfile' - The name or the Amazon Resource Name (ARN) of the instance profile associated with the IAM role for the instance. EC2 instances launched with an IAM role will automatically have AWS security credentials available. You can use IAM roles with Auto Scaling to automatically enable applications running on your EC2 instances to securely access other AWS resources. For more information, see in the /Auto Scaling User Guide/ . -- -- * 'clcImageId' - The ID of the Amazon Machine Image (AMI) to use to launch your EC2 instances. For more information, see in the /Amazon Elastic Compute Cloud User Guide/ . -- -- * 'clcPlacementTenancy' - The tenancy of the instance. An instance with a tenancy of @dedicated@ runs on single-tenant hardware and can only be launched into a VPC. You must set the value of this parameter to @dedicated@ if want to launch Dedicated Instances into a shared tenancy VPC (VPC with instance placement tenancy attribute set to @default@ ). If you specify this parameter, be sure to specify at least one subnet when you create your group. For more information, see in the /Auto Scaling User Guide/ . Valid values: @default@ | @dedicated@ -- -- * 'clcBlockDeviceMappings' - One or more mappings that specify how block devices are exposed to the instance. For more information, see in the /Amazon Elastic Compute Cloud User Guide/ . -- -- * 'clcLaunchConfigurationName' - The name of the launch configuration. This name must be unique within the scope of your AWS account. createLaunchConfiguration :: Text -- ^ 'clcLaunchConfigurationName' -> CreateLaunchConfiguration createLaunchConfiguration pLaunchConfigurationName_ = CreateLaunchConfiguration' { _clcInstanceId = Nothing , _clcAssociatePublicIPAddress = Nothing , _clcSecurityGroups = Nothing , _clcSpotPrice = Nothing , _clcInstanceMonitoring = Nothing , _clcKeyName = Nothing , _clcClassicLinkVPCSecurityGroups = Nothing , _clcRAMDiskId = Nothing , _clcKernelId = Nothing , _clcInstanceType = Nothing , _clcEBSOptimized = Nothing , _clcUserData = Nothing , _clcClassicLinkVPCId = Nothing , _clcIAMInstanceProfile = Nothing , _clcImageId = Nothing , _clcPlacementTenancy = Nothing , _clcBlockDeviceMappings = Nothing , _clcLaunchConfigurationName = pLaunchConfigurationName_ } -- | The ID of the instance to use to create the launch configuration. The new launch configuration derives attributes from the instance, with the exception of the block device mapping. To create a launch configuration with a block device mapping or override any other instance attributes, specify them as part of the same request. For more information, see in the /Auto Scaling User Guide/ . clcInstanceId :: Lens' CreateLaunchConfiguration (Maybe Text) clcInstanceId = lens _clcInstanceId (\ s a -> s{_clcInstanceId = a}); -- | Used for groups that launch instances into a virtual private cloud (VPC). Specifies whether to assign a public IP address to each instance. For more information, see in the /Auto Scaling User Guide/ . If you specify this parameter, be sure to specify at least one subnet when you create your group. Default: If the instance is launched into a default subnet, the default is @true@ . If the instance is launched into a nondefault subnet, the default is @false@ . For more information, see in the /Amazon Elastic Compute Cloud User Guide/ . clcAssociatePublicIPAddress :: Lens' CreateLaunchConfiguration (Maybe Bool) clcAssociatePublicIPAddress = lens _clcAssociatePublicIPAddress (\ s a -> s{_clcAssociatePublicIPAddress = a}); -- | One or more security groups with which to associate the instances. If your instances are launched in EC2-Classic, you can either specify security group names or the security group IDs. For more information about security groups for EC2-Classic, see in the /Amazon Elastic Compute Cloud User Guide/ . If your instances are launched into a VPC, specify security group IDs. For more information, see in the /Amazon Virtual Private Cloud User Guide/ . clcSecurityGroups :: Lens' CreateLaunchConfiguration [Text] clcSecurityGroups = lens _clcSecurityGroups (\ s a -> s{_clcSecurityGroups = a}) . _Default . _Coerce; -- | The maximum hourly price to be paid for any Spot Instance launched to fulfill the request. Spot Instances are launched when the price you specify exceeds the current Spot market price. For more information, see in the /Auto Scaling User Guide/ . clcSpotPrice :: Lens' CreateLaunchConfiguration (Maybe Text) clcSpotPrice = lens _clcSpotPrice (\ s a -> s{_clcSpotPrice = a}); -- | Enables detailed monitoring (@true@ ) or basic monitoring (@false@ ) for the Auto Scaling instances. clcInstanceMonitoring :: Lens' CreateLaunchConfiguration (Maybe InstanceMonitoring) clcInstanceMonitoring = lens _clcInstanceMonitoring (\ s a -> s{_clcInstanceMonitoring = a}); -- | The name of the key pair. For more information, see in the /Amazon Elastic Compute Cloud User Guide/ . clcKeyName :: Lens' CreateLaunchConfiguration (Maybe Text) clcKeyName = lens _clcKeyName (\ s a -> s{_clcKeyName = a}); -- | The IDs of one or more security groups for the specified ClassicLink-enabled VPC. This parameter is required if you specify a ClassicLink-enabled VPC, and is not supported otherwise. For more information, see in the /Amazon Elastic Compute Cloud User Guide/ . clcClassicLinkVPCSecurityGroups :: Lens' CreateLaunchConfiguration [Text] clcClassicLinkVPCSecurityGroups = lens _clcClassicLinkVPCSecurityGroups (\ s a -> s{_clcClassicLinkVPCSecurityGroups = a}) . _Default . _Coerce; -- | The ID of the RAM disk associated with the AMI. clcRAMDiskId :: Lens' CreateLaunchConfiguration (Maybe Text) clcRAMDiskId = lens _clcRAMDiskId (\ s a -> s{_clcRAMDiskId = a}); -- | The ID of the kernel associated with the AMI. clcKernelId :: Lens' CreateLaunchConfiguration (Maybe Text) clcKernelId = lens _clcKernelId (\ s a -> s{_clcKernelId = a}); -- | The instance type of the EC2 instance. For information about available instance types, see in the /Amazon Elastic Compute Cloud User Guide./ clcInstanceType :: Lens' CreateLaunchConfiguration (Maybe Text) clcInstanceType = lens _clcInstanceType (\ s a -> s{_clcInstanceType = a}); -- | Indicates whether the instance is optimized for Amazon EBS I/O. By default, the instance is not optimized for EBS I/O. The optimization provides dedicated throughput to Amazon EBS and an optimized configuration stack to provide optimal I/O performance. This optimization is not available with all instance types. Additional usage charges apply. For more information, see in the /Amazon Elastic Compute Cloud User Guide/ . clcEBSOptimized :: Lens' CreateLaunchConfiguration (Maybe Bool) clcEBSOptimized = lens _clcEBSOptimized (\ s a -> s{_clcEBSOptimized = a}); -- | The user data to make available to the launched EC2 instances. For more information, see in the /Amazon Elastic Compute Cloud User Guide/ . clcUserData :: Lens' CreateLaunchConfiguration (Maybe Text) clcUserData = lens _clcUserData (\ s a -> s{_clcUserData = a}); -- | The ID of a ClassicLink-enabled VPC to link your EC2-Classic instances to. This parameter is supported only if you are launching EC2-Classic instances. For more information, see in the /Amazon Elastic Compute Cloud User Guide/ . clcClassicLinkVPCId :: Lens' CreateLaunchConfiguration (Maybe Text) clcClassicLinkVPCId = lens _clcClassicLinkVPCId (\ s a -> s{_clcClassicLinkVPCId = a}); -- | The name or the Amazon Resource Name (ARN) of the instance profile associated with the IAM role for the instance. EC2 instances launched with an IAM role will automatically have AWS security credentials available. You can use IAM roles with Auto Scaling to automatically enable applications running on your EC2 instances to securely access other AWS resources. For more information, see in the /Auto Scaling User Guide/ . clcIAMInstanceProfile :: Lens' CreateLaunchConfiguration (Maybe Text) clcIAMInstanceProfile = lens _clcIAMInstanceProfile (\ s a -> s{_clcIAMInstanceProfile = a}); -- | The ID of the Amazon Machine Image (AMI) to use to launch your EC2 instances. For more information, see in the /Amazon Elastic Compute Cloud User Guide/ . clcImageId :: Lens' CreateLaunchConfiguration (Maybe Text) clcImageId = lens _clcImageId (\ s a -> s{_clcImageId = a}); -- | The tenancy of the instance. An instance with a tenancy of @dedicated@ runs on single-tenant hardware and can only be launched into a VPC. You must set the value of this parameter to @dedicated@ if want to launch Dedicated Instances into a shared tenancy VPC (VPC with instance placement tenancy attribute set to @default@ ). If you specify this parameter, be sure to specify at least one subnet when you create your group. For more information, see in the /Auto Scaling User Guide/ . Valid values: @default@ | @dedicated@ clcPlacementTenancy :: Lens' CreateLaunchConfiguration (Maybe Text) clcPlacementTenancy = lens _clcPlacementTenancy (\ s a -> s{_clcPlacementTenancy = a}); -- | One or more mappings that specify how block devices are exposed to the instance. For more information, see in the /Amazon Elastic Compute Cloud User Guide/ . clcBlockDeviceMappings :: Lens' CreateLaunchConfiguration [BlockDeviceMapping] clcBlockDeviceMappings = lens _clcBlockDeviceMappings (\ s a -> s{_clcBlockDeviceMappings = a}) . _Default . _Coerce; -- | The name of the launch configuration. This name must be unique within the scope of your AWS account. clcLaunchConfigurationName :: Lens' CreateLaunchConfiguration Text clcLaunchConfigurationName = lens _clcLaunchConfigurationName (\ s a -> s{_clcLaunchConfigurationName = a}); instance AWSRequest CreateLaunchConfiguration where type Rs CreateLaunchConfiguration = CreateLaunchConfigurationResponse request = postQuery autoScaling response = receiveNull CreateLaunchConfigurationResponse' instance Hashable CreateLaunchConfiguration instance NFData CreateLaunchConfiguration instance ToHeaders CreateLaunchConfiguration where toHeaders = const mempty instance ToPath CreateLaunchConfiguration where toPath = const "/" instance ToQuery CreateLaunchConfiguration where toQuery CreateLaunchConfiguration'{..} = mconcat ["Action" =: ("CreateLaunchConfiguration" :: ByteString), "Version" =: ("2011-01-01" :: ByteString), "InstanceId" =: _clcInstanceId, "AssociatePublicIpAddress" =: _clcAssociatePublicIPAddress, "SecurityGroups" =: toQuery (toQueryList "member" <$> _clcSecurityGroups), "SpotPrice" =: _clcSpotPrice, "InstanceMonitoring" =: _clcInstanceMonitoring, "KeyName" =: _clcKeyName, "ClassicLinkVPCSecurityGroups" =: toQuery (toQueryList "member" <$> _clcClassicLinkVPCSecurityGroups), "RamdiskId" =: _clcRAMDiskId, "KernelId" =: _clcKernelId, "InstanceType" =: _clcInstanceType, "EbsOptimized" =: _clcEBSOptimized, "UserData" =: _clcUserData, "ClassicLinkVPCId" =: _clcClassicLinkVPCId, "IamInstanceProfile" =: _clcIAMInstanceProfile, "ImageId" =: _clcImageId, "PlacementTenancy" =: _clcPlacementTenancy, "BlockDeviceMappings" =: toQuery (toQueryList "member" <$> _clcBlockDeviceMappings), "LaunchConfigurationName" =: _clcLaunchConfigurationName] -- | /See:/ 'createLaunchConfigurationResponse' smart constructor. data CreateLaunchConfigurationResponse = CreateLaunchConfigurationResponse' deriving (Eq,Read,Show,Data,Typeable,Generic) -- | Creates a value of 'CreateLaunchConfigurationResponse' with the minimum fields required to make a request. -- createLaunchConfigurationResponse :: CreateLaunchConfigurationResponse createLaunchConfigurationResponse = CreateLaunchConfigurationResponse' instance NFData CreateLaunchConfigurationResponse