create_launch_configuration
async
¶
create_launch_configuration(
*,
config_overrides: Optional[AsyncAutoScalingClientConfig] = None,
launch_configuration_name: Optional[XmlStringMaxLen255] = None,
image_id: Optional[XmlStringMaxLen255] = None,
key_name: Optional[XmlStringMaxLen255] = None,
security_groups: Optional[SecurityGroups] = None,
classic_link_vpc_id: Optional[XmlStringMaxLen255] = None,
classic_link_vpc_security_groups: Optional[ClassicLinkVPCSecurityGroups] = None,
user_data: Optional[XmlStringUserData] = None,
instance_id: Optional[XmlStringMaxLen19] = None,
instance_type: Optional[XmlStringMaxLen255] = None,
kernel_id: Optional[XmlStringMaxLen255] = None,
ramdisk_id: Optional[XmlStringMaxLen255] = None,
block_device_mappings: Optional[BlockDeviceMappings] = None,
instance_monitoring: Optional[InstanceMonitoring] = None,
spot_price: Optional[SpotPrice] = None,
iam_instance_profile: Optional[XmlStringMaxLen1600] = None,
ebs_optimized: Optional[EbsOptimized] = None,
associate_public_ip_address: Optional[AssociatePublicIpAddress] = None,
placement_tenancy: Optional[XmlStringMaxLen64] = None,
metadata_options: Optional[InstanceMetadataOptions] = None,
) -> None
Creates a launch configuration.
If you exceed your maximum limit of launch configurations, the call fails. To query this limit, call the DescribeAccountLimits API. For information about updating this limit, see Quotas for Amazon EC2 Auto Scaling in the Amazon EC2 Auto Scaling User Guide.
For more information, see Launch configurations in the Amazon EC2 Auto Scaling User Guide.
Amazon EC2 Auto Scaling configures instances launched as part of an Auto Scaling group using either a launch template or a launch configuration. We strongly recommend that you do not use launch configurations. They do not provide full functionality for Amazon EC2 Auto Scaling or Amazon EC2. For information about using launch templates, see Launch templates in the Amazon EC2 Auto Scaling User Guide.
Parameters:
-
launch_configuration_name(Optional[XmlStringMaxLen255], default:None) –The name of the launch configuration. This name must be unique per Region per account.
-
image_id(Optional[XmlStringMaxLen255], default:None) –The ID of the Amazon Machine Image (AMI) that was assigned during registration. For more information, see Find a Linux AMI in the Amazon EC2 User Guide.
If you specify
InstanceId, anImageIdis not required. -
key_name(Optional[XmlStringMaxLen255], default:None) –The name of the key pair. For more information, see Amazon EC2 key pairs and Amazon EC2 instances in the Amazon EC2 User Guide.
-
security_groups(Optional[SecurityGroups], default:None) –A list that contains the security group IDs to assign to the instances in the Auto Scaling group. For more information, see Control traffic to your Amazon Web Services resources using security groups in the Amazon Virtual Private Cloud User Guide.
-
classic_link_vpc_id(Optional[XmlStringMaxLen255], default:None) –Available for backward compatibility.
-
classic_link_vpc_security_groups(Optional[ClassicLinkVPCSecurityGroups], default:None) –Available for backward compatibility.
-
user_data(Optional[XmlStringUserData], default:None) –The user data to make available to the launched EC2 instances. For more information, see Instance metadata and user data (Linux) and Instance metadata and user data (Windows). If you are using a 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. User data is limited to 16 KB.
-
instance_id(Optional[XmlStringMaxLen19], default:None) –The ID of the instance to use to create the launch configuration. The new launch configuration derives attributes from the instance, except for 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 Create a launch configuration in the Amazon EC2 Auto Scaling User Guide.
-
instance_type(Optional[XmlStringMaxLen255], default:None) –Specifies the instance type of the EC2 instance. For information about available instance types, see Available instance types in the Amazon EC2 User Guide.
If you specify
InstanceId, anInstanceTypeis not required. -
kernel_id(Optional[XmlStringMaxLen255], default:None) –The ID of the kernel associated with the AMI.
We recommend that you use PV-GRUB instead of kernels and RAM disks. For more information, see User provided kernels in the Amazon EC2 User Guide.
-
ramdisk_id(Optional[XmlStringMaxLen255], default:None) –The ID of the RAM disk to select.
We recommend that you use PV-GRUB instead of kernels and RAM disks. For more information, see User provided kernels in the Amazon EC2 User Guide.
-
block_device_mappings(Optional[BlockDeviceMappings], default:None) –The block device mapping entries that define the block devices to attach to the instances at launch. By default, the block devices specified in the block device mapping for the AMI are used. For more information, see Block device mappings in the Amazon EC2 User Guide.
-
instance_monitoring(Optional[InstanceMonitoring], default:None) –Controls whether instances in this group are launched with detailed (
true) or basic (false) monitoring.The default value is
true(enabled).When detailed monitoring is enabled, Amazon CloudWatch generates metrics every minute and your account is charged a fee. When you disable detailed monitoring, CloudWatch generates metrics every 5 minutes. For more information, see Configure monitoring for Auto Scaling instances in the Amazon EC2 Auto Scaling User Guide.
-
spot_price(Optional[SpotPrice], default:None) –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 price. For more information, see Request Spot Instances for fault-tolerant and flexible applications in the Amazon EC2 Auto Scaling User Guide.
Valid Range: Minimum value of 0.001
When you change your maximum price by creating a new launch configuration, running instances will continue to run as long as the maximum price for those running instances is higher than the current Spot price.
-
iam_instance_profile(Optional[XmlStringMaxLen1600], default:None) –The name or the Amazon Resource Name (ARN) of the instance profile associated with the IAM role for the instance. The instance profile contains the IAM role. For more information, see IAM role for applications that run on Amazon EC2 instances in the Amazon EC2 Auto Scaling User Guide.
-
ebs_optimized(Optional[EbsOptimized], default:None) –Specifies whether the launch configuration is optimized for EBS I/O (
true) or not (false). 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 fees are incurred when you enable EBS optimization for an instance type that is not EBS-optimized by default. For more information, see Amazon EBS-optimized instances in the Amazon EC2 User Guide.The default value is
false. -
associate_public_ip_address(Optional[AssociatePublicIpAddress], default:None) –Specifies whether to assign a public IPv4 address to the group's instances. If the instance is launched into a default subnet, the default is to assign a public IPv4 address, unless you disabled the option to assign a public IPv4 address on the subnet. If the instance is launched into a nondefault subnet, the default is not to assign a public IPv4 address, unless you enabled the option to assign a public IPv4 address on the subnet.
If you specify
true, each instance in the Auto Scaling group receives a unique public IPv4 address. For more information, see Provide network connectivity for your Auto Scaling instances using Amazon VPC in the Amazon EC2 Auto Scaling User Guide.If you specify this property, you must specify at least one subnet for
VPCZoneIdentifierwhen you create your group. -
placement_tenancy(Optional[XmlStringMaxLen64], default:None) –The tenancy of the instance, either
defaultordedicated. An instance withdedicatedtenancy runs on isolated, single-tenant hardware and can only be launched into a VPC. To launch dedicated instances into a shared tenancy VPC (a VPC with the instance placement tenancy attribute set todefault), you must set the value of this property todedicated.If you specify
PlacementTenancy, you must specify at least one subnet forVPCZoneIdentifierwhen you create your group.Valid values:
default|dedicated -
metadata_options(Optional[InstanceMetadataOptions], default:None) –The metadata options for the instances. For more information, see Configure the instance metadata options in the Amazon EC2 Auto Scaling User Guide.
Raises:
-
AlreadyExistsFault–You already have an Auto Scaling group or launch configuration with this name.
-
LimitExceededFault–You have already reached a limit for your Amazon EC2 Auto Scaling resources (for example, Auto Scaling groups, launch configurations, or lifecycle hooks). For more information, see DescribeAccountLimits in the Amazon EC2 Auto Scaling API Reference.
-
ResourceContentionFault–You already have a pending update to an Amazon EC2 Auto Scaling resource (for example, an Auto Scaling group, instance, or load balancer).
-
UnknownServiceError–The service returned an error code this client does not model.
Examples:
To create a launch configuration This example creates a launch configuration.
>>> await client.create_launch_configuration(launch_configuration_name='my-launch-config', image_id='ami-12345678', security_groups=['sg-eb2af88e'], instance_type='m3.medium', iam_instance_profile='my-iam-role')
Source code in docs_src/capo_auto_scaling/_services/async_auto_scaling.py
1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 | |