CfnLaunchConfiguration¶
-
class
aws_cdk.aws_autoscaling.
CfnLaunchConfiguration
(scope, id, *, image_id, instance_type, associate_public_ip_address=None, block_device_mappings=None, classic_link_vpc_id=None, classic_link_vpc_security_groups=None, ebs_optimized=None, iam_instance_profile=None, instance_id=None, instance_monitoring=None, kernel_id=None, key_name=None, launch_configuration_name=None, metadata_options=None, placement_tenancy=None, ram_disk_id=None, security_groups=None, spot_price=None, user_data=None)¶ Bases:
aws_cdk.core.CfnResource
A CloudFormation
AWS::AutoScaling::LaunchConfiguration
.The
AWS::AutoScaling::LaunchConfiguration
resource specifies the launch configuration that can be used by an Auto Scaling group to configure Amazon EC2 instances.When you update the launch configuration for an Auto Scaling group, CloudFormation deletes that resource and creates a new launch configuration with the updated properties and a new name. Existing instances are not affected. To update existing instances when you update the
AWS::AutoScaling::LaunchConfiguration
resource, you can specify an UpdatePolicy attribute for the group. You can find sample update policies for rolling updates in Auto scaling template snippets .For more information, see Launch configurations in the Amazon EC2 Auto Scaling User Guide . .. epigraph:
To configure Amazon EC2 instances launched as part of the Auto Scaling group, you can specify a launch template or a launch configuration. We recommend that you use a `launch template <https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-launchtemplate.html>`_ to make sure that you can use the latest features of Amazon EC2, such as Dedicated Hosts and T2 Unlimited instances. For more information, see `Creating a launch template for an Auto Scaling group <https://docs.aws.amazon.com/autoscaling/ec2/userguide/create-launch-template.html>`_ .
- CloudformationResource
AWS::AutoScaling::LaunchConfiguration
- Link
- ExampleMetadata
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_autoscaling as autoscaling cfn_launch_configuration = autoscaling.CfnLaunchConfiguration(self, "MyCfnLaunchConfiguration", image_id="imageId", instance_type="instanceType", # the properties below are optional associate_public_ip_address=False, block_device_mappings=[autoscaling.CfnLaunchConfiguration.BlockDeviceMappingProperty( device_name="deviceName", # the properties below are optional ebs=autoscaling.CfnLaunchConfiguration.BlockDeviceProperty( delete_on_termination=False, encrypted=False, iops=123, snapshot_id="snapshotId", throughput=123, volume_size=123, volume_type="volumeType" ), no_device=False, virtual_name="virtualName" )], classic_link_vpc_id="classicLinkVpcId", classic_link_vpc_security_groups=["classicLinkVpcSecurityGroups"], ebs_optimized=False, iam_instance_profile="iamInstanceProfile", instance_id="instanceId", instance_monitoring=False, kernel_id="kernelId", key_name="keyName", launch_configuration_name="launchConfigurationName", metadata_options=autoscaling.CfnLaunchConfiguration.MetadataOptionsProperty( http_endpoint="httpEndpoint", http_put_response_hop_limit=123, http_tokens="httpTokens" ), placement_tenancy="placementTenancy", ram_disk_id="ramDiskId", security_groups=["securityGroups"], spot_price="spotPrice", user_data="userData" )
Create a new
AWS::AutoScaling::LaunchConfiguration
.- Parameters
scope (
Construct
) –scope in which this resource is defined.
id (
str
) –scoped id of the resource.
image_id (
str
) – Provides the unique 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 for Linux Instances .instance_type (
str
) – Specifies the instance type of the EC2 instance. For information about available instance types, see Available instance types in the Amazon EC2 User Guide for Linux Instances .associate_public_ip_address (
Union
[bool
,IResolvable
,None
]) – For Auto Scaling groups that are running in a virtual private cloud (VPC), specifies whether to assign a public IP address to the group’s instances. If you specifytrue
, each instance in the Auto Scaling group receives a unique public IP address. For more information, see Launching Auto Scaling instances in a VPC in the Amazon EC2 Auto Scaling User Guide . If an instance receives a public IP address and is also in a VPC that is defined in the same stack template, you must use the DependsOn attribute to declare a dependency on the VPC-gateway attachment . .. epigraph:: If the instance is launched into a default subnet, the default is to assign a public IP address, unless you disabled the option to assign a public IP address on the subnet. If the instance is launched into a nondefault subnet, the default is not to assign a public IP address, unless you enabled the option to assign a public IP address on the subnet.block_device_mappings (
Union
[IResolvable
,Sequence
[Union
[IResolvable
,BlockDeviceMappingProperty
]],None
]) – Specifies how block devices are exposed to the instance. You can specify virtual devices and EBS volumes.classic_link_vpc_id (
Optional
[str
]) – EC2-Classic retires on August 15, 2022. This parameter is not supported after that date.. The ID of a ClassicLink-enabled VPC to link your EC2-Classic instances to.classic_link_vpc_security_groups (
Optional
[Sequence
[str
]]) – EC2-Classic retires on August 15, 2022. This parameter is not supported after that date.. The IDs of one or more security groups for the VPC that you specified in theClassicLinkVPCId
property. If you specify theClassicLinkVPCId
property, you must specify this property.ebs_optimized (
Union
[bool
,IResolvable
,None
]) – Specifies whether the launch configuration is optimized for EBS I/O (true
) or not (false
). This optimization provides dedicated throughput to Amazon EBS and an optimized configuration stack to provide optimal EBS I/O performance. 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 for Linux Instances . The default value isfalse
.iam_instance_profile (
Optional
[str
]) – Provides 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 .instance_id (
Optional
[str
]) – The ID of the Amazon EC2 instance you want to use to create the launch configuration. Use this property if you want the launch configuration to use settings from an existing Amazon EC2 instance. When you use an instance to create a launch configuration, all properties are derived from the instance with the exception ofBlockDeviceMapping
andAssociatePublicIpAddress
. You can override any properties from the instance by specifying them in the launch configuration.instance_monitoring (
Union
[bool
,IResolvable
,None
]) – Controls whether instances in this group are launched with detailed (true
) or basic (false
) monitoring. The default value istrue
(enabled). .. epigraph:: 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 .kernel_id (
Optional
[str
]) – Provides the ID of the kernel associated with the EC2 AMI. .. epigraph:: 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 for Linux Instances .key_name (
Optional
[str
]) – Provides the name of the EC2 key pair. .. epigraph:: 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. For information on creating a key pair, see Amazon EC2 key pairs and Linux instances in the Amazon EC2 User Guide for Linux Instances .launch_configuration_name (
Optional
[str
]) – The name of the launch configuration. This name must be unique per Region per account.metadata_options (
Union
[IResolvable
,MetadataOptionsProperty
,None
]) – The metadata options for the instances. For more information, see Configuring the Instance Metadata Options in the Amazon EC2 Auto Scaling User Guide .placement_tenancy (
Optional
[str
]) – The tenancy of the instance, eitherdefault
ordedicated
. An instance withdedicated
tenancy runs on isolated, single-tenant hardware and can only be launched into a VPC. You must set the value of this property todedicated
if want to launch dedicated instances in a shared tenancy VPC (a VPC with the instance placement tenancy attribute set to default). If you specify this property, you must specify at least one subnet in theVPCZoneIdentifier
property of the AWS::AutoScaling::AutoScalingGroup resource. For more information, see Configure instance tenancy with Amazon EC2 Auto Scaling in the Amazon EC2 Auto Scaling User Guide .ram_disk_id (
Optional
[str
]) –The ID of the RAM disk to select. .. epigraph:: 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 for Linux Instances .
security_groups (
Optional
[Sequence
[str
]]) – A list that contains the security groups to assign to the instances in the Auto Scaling group. The list can contain both the IDs of existing security groups and references to SecurityGroup resources created in the template. For more information, see Security groups for your VPC in the Amazon Virtual Private Cloud User Guide .spot_price (
Optional
[str
]) – The maximum hourly price you are willing to pay for any Spot Instances 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 . .. epigraph:: 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. Valid Range: Minimum value of 0.001user_data (
Optional
[str
]) – The Base64-encoded user data to make available to the launched EC2 instances. For more information, see Instance metadata and user data in the Amazon EC2 User Guide for Linux Instances .
Methods
-
add_deletion_override
(path)¶ Syntactic sugar for
addOverride(path, undefined)
.- Parameters
path (
str
) – The path of the value to delete.- Return type
None
-
add_depends_on
(target)¶ Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned.
This can be used for resources across stacks (or nested stack) boundaries and the dependency will automatically be transferred to the relevant scope.
- Parameters
target (
CfnResource
) –- Return type
None
-
add_metadata
(key, value)¶ Add a value to the CloudFormation Resource Metadata.
- Parameters
key (
str
) –value (
Any
) –
- See
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/metadata-section-structure.html
Note that this is a different set of metadata from CDK node metadata; this metadata ends up in the stack template under the resource, whereas CDK node metadata ends up in the Cloud Assembly.
- Return type
None
-
add_override
(path, value)¶ Adds an override to the synthesized CloudFormation resource.
To add a property override, either use
addPropertyOverride
or prefixpath
with “Properties.” (i.e.Properties.TopicName
).If the override is nested, separate each nested level using a dot (.) in the path parameter. If there is an array as part of the nesting, specify the index in the path.
To include a literal
.
in the property name, prefix with a\
. In most programming languages you will need to write this as"\\."
because the\
itself will need to be escaped.For example:
cfn_resource.add_override("Properties.GlobalSecondaryIndexes.0.Projection.NonKeyAttributes", ["myattribute"]) cfn_resource.add_override("Properties.GlobalSecondaryIndexes.1.ProjectionType", "INCLUDE")
would add the overrides Example:
"Properties": { "GlobalSecondaryIndexes": [ { "Projection": { "NonKeyAttributes": [ "myattribute" ] ... } ... }, { "ProjectionType": "INCLUDE" ... }, ] ... }
The
value
argument toaddOverride
will not be processed or translated in any way. Pass raw JSON values in here with the correct capitalization for CloudFormation. If you pass CDK classes or structs, they will be rendered with lowercased key names, and CloudFormation will reject the template.- Parameters
path (
str
) –The path of the property, you can use dot notation to override values in complex types. Any intermdediate keys will be created as needed.
value (
Any
) –The value. Could be primitive or complex.
- Return type
None
-
add_property_deletion_override
(property_path)¶ Adds an override that deletes the value of a property from the resource definition.
- Parameters
property_path (
str
) – The path to the property.- Return type
None
-
add_property_override
(property_path, value)¶ Adds an override to a resource property.
Syntactic sugar for
addOverride("Properties.<...>", value)
.- Parameters
property_path (
str
) – The path of the property.value (
Any
) – The value.
- Return type
None
-
apply_removal_policy
(policy=None, *, apply_to_update_replace_policy=None, default=None)¶ Sets the deletion policy of the resource based on the removal policy specified.
The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you’ve removed it from the CDK application or because you’ve made a change that requires the resource to be replaced.
The resource can be deleted (
RemovalPolicy.DESTROY
), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN
).- Parameters
policy (
Optional
[RemovalPolicy
]) –apply_to_update_replace_policy (
Optional
[bool
]) – Apply the same deletion policy to the resource’s “UpdateReplacePolicy”. Default: truedefault (
Optional
[RemovalPolicy
]) – The default policy to apply in case the removal policy is not defined. Default: - Default value is resource specific. To determine the default value for a resoure, please consult that specific resource’s documentation.
- Return type
None
-
get_att
(attribute_name)¶ Returns a token for an runtime attribute of this resource.
Ideally, use generated attribute accessors (e.g.
resource.arn
), but this can be used for future compatibility in case there is no generated attribute.- Parameters
attribute_name (
str
) – The name of the attribute.- Return type
-
get_metadata
(key)¶ Retrieve a value value from the CloudFormation Resource Metadata.
- Parameters
key (
str
) –- See
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/metadata-section-structure.html
Note that this is a different set of metadata from CDK node metadata; this metadata ends up in the stack template under the resource, whereas CDK node metadata ends up in the Cloud Assembly.
- Return type
Any
-
inspect
(inspector)¶ Examines the CloudFormation resource and discloses attributes.
- Parameters
inspector (
TreeInspector
) –tree inspector to collect and process attributes.
- Return type
None
-
override_logical_id
(new_logical_id)¶ Overrides the auto-generated logical ID with a specific ID.
- Parameters
new_logical_id (
str
) – The new logical ID to use for this stack element.- Return type
None
-
to_string
()¶ Returns a string representation of this construct.
- Return type
str
- Returns
a string representation of this resource
Attributes
-
CFN_RESOURCE_TYPE_NAME
= 'AWS::AutoScaling::LaunchConfiguration'¶
-
associate_public_ip_address
¶ For Auto Scaling groups that are running in a virtual private cloud (VPC), specifies whether to assign a public IP address to the group’s instances.
If you specify
true
, each instance in the Auto Scaling group receives a unique public IP address. For more information, see Launching Auto Scaling instances in a VPC in the Amazon EC2 Auto Scaling User Guide .If an instance receives a public IP address and is also in a VPC that is defined in the same stack template, you must use the DependsOn attribute to declare a dependency on the VPC-gateway attachment . .. epigraph:
If the instance is launched into a default subnet, the default is to assign a public IP address, unless you disabled the option to assign a public IP address on the subnet. If the instance is launched into a nondefault subnet, the default is not to assign a public IP address, unless you enabled the option to assign a public IP address on the subnet.
-
block_device_mappings
¶ Specifies how block devices are exposed to the instance.
You can specify virtual devices and EBS volumes.
-
cfn_options
¶ Options for this resource, such as condition, update policy etc.
- Return type
-
cfn_resource_type
¶ AWS resource type.
- Return type
str
-
classic_link_vpc_id
¶ EC2-Classic retires on August 15, 2022. This parameter is not supported after that date..
The ID of a ClassicLink-enabled VPC to link your EC2-Classic instances to.
-
classic_link_vpc_security_groups
¶ EC2-Classic retires on August 15, 2022. This parameter is not supported after that date..
The IDs of one or more security groups for the VPC that you specified in the
ClassicLinkVPCId
property.If you specify the
ClassicLinkVPCId
property, you must specify this property.
-
creation_stack
¶ return:
the stack trace of the point where this Resource was created from, sourced from the +metadata+ entry typed +aws:cdk:logicalId+, and with the bottom-most node +internal+ entries filtered.
- Return type
List
[str
]
-
ebs_optimized
¶ Specifies whether the launch configuration is optimized for EBS I/O (
true
) or not (false
).This optimization provides dedicated throughput to Amazon EBS and an optimized configuration stack to provide optimal EBS I/O performance. 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 for Linux Instances .
The default value is
false
.
-
iam_instance_profile
¶ Provides 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 .
-
image_id
¶ Provides the unique 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 for Linux Instances .
-
instance_id
¶ The ID of the Amazon EC2 instance you want to use to create the launch configuration.
Use this property if you want the launch configuration to use settings from an existing Amazon EC2 instance. When you use an instance to create a launch configuration, all properties are derived from the instance with the exception of
BlockDeviceMapping
andAssociatePublicIpAddress
. You can override any properties from the instance by specifying them in the launch configuration.
-
instance_monitoring
¶ Controls whether instances in this group are launched with detailed (
true
) or basic (false
) monitoring.The default value is
true
(enabled). .. epigraph: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 <https://docs.aws.amazon.com/autoscaling/latest/userguide/as-instance-monitoring.html#enable-as-instance-metrics>`_ in the *Amazon EC2 Auto Scaling User Guide* .
-
instance_type
¶ Specifies the instance type of the EC2 instance.
For information about available instance types, see Available instance types in the Amazon EC2 User Guide for Linux Instances .
-
kernel_id
¶ Provides the ID of the kernel associated with the EC2 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 for Linux Instances .
-
key_name
¶ Provides the name of the EC2 key pair.
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. For information on creating a key pair, see Amazon EC2 key pairs and Linux instances in the Amazon EC2 User Guide for Linux Instances .
-
launch_configuration_name
¶ The name of the launch configuration.
This name must be unique per Region per account.
-
logical_id
¶ The logical ID for this CloudFormation stack element.
The logical ID of the element is calculated from the path of the resource node in the construct tree.
To override this value, use
overrideLogicalId(newLogicalId)
.- Return type
str
- Returns
the logical ID as a stringified token. This value will only get resolved during synthesis.
-
metadata_options
¶ The metadata options for the instances.
For more information, see Configuring the Instance Metadata Options in the Amazon EC2 Auto Scaling User Guide .
-
node
¶ The construct tree node associated with this construct.
- Return type
-
placement_tenancy
¶ The tenancy of the instance, either
default
ordedicated
.An instance with
dedicated
tenancy runs on isolated, single-tenant hardware and can only be launched into a VPC. You must set the value of this property todedicated
if want to launch dedicated instances in a shared tenancy VPC (a VPC with the instance placement tenancy attribute set to default).If you specify this property, you must specify at least one subnet in the
VPCZoneIdentifier
property of the AWS::AutoScaling::AutoScalingGroup resource.For more information, see Configure instance tenancy with Amazon EC2 Auto Scaling in the Amazon EC2 Auto Scaling User Guide .
-
ram_disk_id
¶ 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 for Linux Instances .
-
ref
¶ Return a string that will be resolved to a CloudFormation
{ Ref }
for this element.If, by any chance, the intrinsic reference of a resource is not a string, you could coerce it to an IResolvable through
Lazy.any({ produce: resource.ref })
.- Return type
str
-
security_groups
¶ A list that contains the security groups to assign to the instances in the Auto Scaling group.
The list can contain both the IDs of existing security groups and references to SecurityGroup resources created in the template.
For more information, see Security groups for your VPC in the Amazon Virtual Private Cloud User Guide .
-
spot_price
¶ The maximum hourly price you are willing to pay for any Spot Instances 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 . .. epigraph:
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.
Valid Range: Minimum value of 0.001
-
stack
¶ The stack in which this element is defined.
CfnElements must be defined within a stack scope (directly or indirectly).
- Return type
-
user_data
¶ The Base64-encoded user data to make available to the launched EC2 instances.
For more information, see Instance metadata and user data in the Amazon EC2 User Guide for Linux Instances .
Static Methods
-
classmethod
is_cfn_element
(x)¶ Returns
true
if a construct is a stack element (i.e. part of the synthesized cloudformation template).Uses duck-typing instead of
instanceof
to allow stack elements from different versions of this library to be included in the same stack.- Parameters
x (
Any
) –- Return type
bool
- Returns
The construct as a stack element or undefined if it is not a stack element.
-
classmethod
is_cfn_resource
(construct)¶ Check whether the given construct is a CfnResource.
- Parameters
construct (
IConstruct
) –- Return type
bool
-
classmethod
is_construct
(x)¶ Return whether the given object is a Construct.
- Parameters
x (
Any
) –- Return type
bool
BlockDeviceMappingProperty¶
-
class
CfnLaunchConfiguration.
BlockDeviceMappingProperty
(*, device_name, ebs=None, no_device=None, virtual_name=None)¶ Bases:
object
BlockDeviceMapping
specifies a block device mapping for theBlockDeviceMappings
property of the AWS::AutoScaling::LaunchConfiguration resource.Each instance that is launched has an associated root device volume, either an Amazon EBS volume or an instance store volume. You can use block device mappings to specify additional EBS volumes or instance store volumes to attach to an instance when it is launched.
For more information, see Example block device mapping in the Amazon EC2 User Guide for Linux Instances .
- Parameters
device_name (
str
) – The device name exposed to the EC2 instance (for example,/dev/sdh
orxvdh
). For more information, see Device naming on Linux instances in the Amazon EC2 User Guide for Linux Instances .ebs (
Union
[IResolvable
,BlockDeviceProperty
,None
]) – Parameters used to automatically set up EBS volumes when an instance is launched. You can specify eitherVirtualName
orEbs
, but not both.no_device (
Union
[bool
,IResolvable
,None
]) – Setting this value totrue
suppresses the specified device included in the block device mapping of the AMI. IfNoDevice
istrue
for the root device, instances might fail the EC2 health check. In that case, Amazon EC2 Auto Scaling launches replacement instances. If you specifyNoDevice
, you cannot specifyEbs
.virtual_name (
Optional
[str
]) – The name of the virtual device. The name must be in the form ephemeral X where X is a number starting from zero (0), for example,ephemeral0
. You can specify eitherVirtualName
orEbs
, but not both.
- Link
- ExampleMetadata
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_autoscaling as autoscaling block_device_mapping_property = autoscaling.CfnLaunchConfiguration.BlockDeviceMappingProperty( device_name="deviceName", # the properties below are optional ebs=autoscaling.CfnLaunchConfiguration.BlockDeviceProperty( delete_on_termination=False, encrypted=False, iops=123, snapshot_id="snapshotId", throughput=123, volume_size=123, volume_type="volumeType" ), no_device=False, virtual_name="virtualName" )
Attributes
-
device_name
¶ The device name exposed to the EC2 instance (for example,
/dev/sdh
orxvdh
).For more information, see Device naming on Linux instances in the Amazon EC2 User Guide for Linux Instances .
-
ebs
¶ Parameters used to automatically set up EBS volumes when an instance is launched.
You can specify either
VirtualName
orEbs
, but not both.
-
no_device
¶ Setting this value to
true
suppresses the specified device included in the block device mapping of the AMI.If
NoDevice
istrue
for the root device, instances might fail the EC2 health check. In that case, Amazon EC2 Auto Scaling launches replacement instances.If you specify
NoDevice
, you cannot specifyEbs
.
-
virtual_name
¶ The name of the virtual device.
The name must be in the form ephemeral X where X is a number starting from zero (0), for example,
ephemeral0
.You can specify either
VirtualName
orEbs
, but not both.
BlockDeviceProperty¶
-
class
CfnLaunchConfiguration.
BlockDeviceProperty
(*, delete_on_termination=None, encrypted=None, iops=None, snapshot_id=None, throughput=None, volume_size=None, volume_type=None)¶ Bases:
object
BlockDevice
is a property of theEBS
property of the AWS::AutoScaling::LaunchConfiguration BlockDeviceMapping property type that describes an Amazon EBS volume.- Parameters
delete_on_termination (
Union
[bool
,IResolvable
,None
]) – Indicates whether the volume is deleted on instance termination. For Amazon EC2 Auto Scaling, the default value istrue
.encrypted (
Union
[bool
,IResolvable
,None
]) – Specifies whether the volume should be encrypted. Encrypted EBS volumes can only be attached to instances that support Amazon EBS encryption. For more information, see Supported instance types . If your AMI uses encrypted volumes, you can also only launch it on supported instance types. .. epigraph:: If you are creating a volume from a snapshot, you cannot create an unencrypted volume from an encrypted snapshot. Also, you cannot specify a KMS key ID when using a launch configuration. If you enable encryption by default, the EBS volumes that you create are always encrypted, either using the AWS managed KMS key or a customer-managed KMS key, regardless of whether the snapshot was encrypted. For more information, see Use AWS KMS keys to encrypt Amazon EBS volumes in the Amazon EC2 Auto Scaling User Guide .iops (
Union
[int
,float
,None
]) – The number of input/output (I/O) operations per second (IOPS) to provision for the volume. Forgp3
andio1
volumes, this represents the number of IOPS that are provisioned for the volume. Forgp2
volumes, this represents the baseline performance of the volume and the rate at which the volume accumulates I/O credits for bursting. The following are the supported values for each volume type: -gp3
: 3,000-16,000 IOPS -io1
: 100-64,000 IOPS Forio1
volumes, we guarantee 64,000 IOPS only for Instances built on the Nitro System . Other instance families guarantee performance up to 32,000 IOPS.Iops
is supported when the volume type isgp3
orio1
and required only when the volume type isio1
. (Not used withstandard
,gp2
,st1
, orsc1
volumes.)snapshot_id (
Optional
[str
]) – The snapshot ID of the volume to use. You must specify either aVolumeSize
or aSnapshotId
.throughput (
Union
[int
,float
,None
]) – The throughput (MiBps) to provision for agp3
volume.volume_size (
Union
[int
,float
,None
]) – The volume size, in GiBs. The following are the supported volumes sizes for each volume type:. -gp2
andgp3
: 1-16,384 -io1
: 4-16,384 -st1
andsc1
: 125-16,384 -standard
: 1-1,024 You must specify either aSnapshotId
or aVolumeSize
. If you specify bothSnapshotId
andVolumeSize
, the volume size must be equal or greater than the size of the snapshot.volume_type (
Optional
[str
]) – The volume type. For more information, see Amazon EBS Volume Types in the Amazon EC2 User Guide for Linux Instances . Valid Values:standard
|io1
|gp2
|st1
|sc1
|gp3
- Link
- ExampleMetadata
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_autoscaling as autoscaling block_device_property = autoscaling.CfnLaunchConfiguration.BlockDeviceProperty( delete_on_termination=False, encrypted=False, iops=123, snapshot_id="snapshotId", throughput=123, volume_size=123, volume_type="volumeType" )
Attributes
-
delete_on_termination
¶ Indicates whether the volume is deleted on instance termination.
For Amazon EC2 Auto Scaling, the default value is
true
.
-
encrypted
¶ Specifies whether the volume should be encrypted.
Encrypted EBS volumes can only be attached to instances that support Amazon EBS encryption. For more information, see Supported instance types . If your AMI uses encrypted volumes, you can also only launch it on supported instance types. .. epigraph:
If you are creating a volume from a snapshot, you cannot create an unencrypted volume from an encrypted snapshot. Also, you cannot specify a KMS key ID when using a launch configuration. If you enable encryption by default, the EBS volumes that you create are always encrypted, either using the AWS managed KMS key or a customer-managed KMS key, regardless of whether the snapshot was encrypted. For more information, see `Use AWS KMS keys to encrypt Amazon EBS volumes <https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-data-protection.html#encryption>`_ in the *Amazon EC2 Auto Scaling User Guide* .
-
iops
¶ The number of input/output (I/O) operations per second (IOPS) to provision for the volume.
For
gp3
andio1
volumes, this represents the number of IOPS that are provisioned for the volume. Forgp2
volumes, this represents the baseline performance of the volume and the rate at which the volume accumulates I/O credits for bursting.The following are the supported values for each volume type:
gp3
: 3,000-16,000 IOPSio1
: 100-64,000 IOPS
For
io1
volumes, we guarantee 64,000 IOPS only for Instances built on the Nitro System . Other instance families guarantee performance up to 32,000 IOPS.Iops
is supported when the volume type isgp3
orio1
and required only when the volume type isio1
. (Not used withstandard
,gp2
,st1
, orsc1
volumes.)
-
snapshot_id
¶ The snapshot ID of the volume to use.
You must specify either a
VolumeSize
or aSnapshotId
.
-
throughput
¶ The throughput (MiBps) to provision for a
gp3
volume.
-
volume_size
¶ .
gp2
andgp3
: 1-16,384io1
: 4-16,384st1
andsc1
: 125-16,384standard
: 1-1,024
You must specify either a
SnapshotId
or aVolumeSize
. If you specify bothSnapshotId
andVolumeSize
, the volume size must be equal or greater than the size of the snapshot.- Link
- Type
The volume size, in GiBs. The following are the supported volumes sizes for each volume type
- Return type
Union
[int
,float
,None
]
-
volume_type
¶ The volume type.
For more information, see Amazon EBS Volume Types in the Amazon EC2 User Guide for Linux Instances .
Valid Values:
standard
|io1
|gp2
|st1
|sc1
|gp3
MetadataOptionsProperty¶
-
class
CfnLaunchConfiguration.
MetadataOptionsProperty
(*, http_endpoint=None, http_put_response_hop_limit=None, http_tokens=None)¶ Bases:
object
MetadataOptions
is a property of AWS::AutoScaling::LaunchConfiguration that describes metadata options for the instances.For more information, see Configure the instance metadata options in the Amazon EC2 Auto Scaling User Guide .
- Parameters
http_endpoint (
Optional
[str
]) – This parameter enables or disables the HTTP metadata endpoint on your instances. If the parameter is not specified, the default state isenabled
. .. epigraph:: If you specify a value ofdisabled
, you will not be able to access your instance metadata.http_put_response_hop_limit (
Union
[int
,float
,None
]) – The desired HTTP PUT response hop limit for instance metadata requests. The larger the number, the further instance metadata requests can travel. Default: 1http_tokens (
Optional
[str
]) – The state of token usage for your instance metadata requests. If the parameter is not specified in the request, the default state isoptional
. If the state isoptional
, you can choose to retrieve instance metadata with or without a signed token header on your request. If you retrieve the IAM role credentials without a token, the version 1.0 role credentials are returned. If you retrieve the IAM role credentials using a valid signed token, the version 2.0 role credentials are returned. If the state isrequired
, you must send a signed token header with any instance metadata retrieval requests. In this state, retrieving the IAM role credentials always returns the version 2.0 credentials; the version 1.0 credentials are not available.
- Link
- ExampleMetadata
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_autoscaling as autoscaling metadata_options_property = autoscaling.CfnLaunchConfiguration.MetadataOptionsProperty( http_endpoint="httpEndpoint", http_put_response_hop_limit=123, http_tokens="httpTokens" )
Attributes
-
http_endpoint
¶ This parameter enables or disables the HTTP metadata endpoint on your instances.
If the parameter is not specified, the default state is
enabled
. .. epigraph:If you specify a value of ``disabled`` , you will not be able to access your instance metadata.
-
http_put_response_hop_limit
¶ The desired HTTP PUT response hop limit for instance metadata requests.
The larger the number, the further instance metadata requests can travel.
Default: 1
-
http_tokens
¶ The state of token usage for your instance metadata requests.
If the parameter is not specified in the request, the default state is
optional
.If the state is
optional
, you can choose to retrieve instance metadata with or without a signed token header on your request. If you retrieve the IAM role credentials without a token, the version 1.0 role credentials are returned. If you retrieve the IAM role credentials using a valid signed token, the version 2.0 role credentials are returned.If the state is
required
, you must send a signed token header with any instance metadata retrieval requests. In this state, retrieving the IAM role credentials always returns the version 2.0 credentials; the version 1.0 credentials are not available.