CfnInstance

class aws_cdk.aws_ec2.CfnInstance(scope, id, *, additional_info=None, affinity=None, availability_zone=None, block_device_mappings=None, cpu_options=None, credit_specification=None, disable_api_termination=None, ebs_optimized=None, elastic_gpu_specifications=None, elastic_inference_accelerators=None, enclave_options=None, hibernation_options=None, host_id=None, host_resource_group_arn=None, iam_instance_profile=None, image_id=None, instance_initiated_shutdown_behavior=None, instance_type=None, ipv6_address_count=None, ipv6_addresses=None, kernel_id=None, key_name=None, launch_template=None, license_specifications=None, monitoring=None, network_interfaces=None, placement_group_name=None, private_dns_name_options=None, private_ip_address=None, propagate_tags_to_volume_on_creation=None, ramdisk_id=None, security_group_ids=None, security_groups=None, source_dest_check=None, ssm_associations=None, subnet_id=None, tags=None, tenancy=None, user_data=None, volumes=None)

Bases: aws_cdk.core.CfnResource

A CloudFormation AWS::EC2::Instance.

Specifies an EC2 instance.

If an Elastic IP address is attached to your instance, AWS CloudFormation reattaches the Elastic IP address after it updates the instance. For more information about updating stacks, see AWS CloudFormation Stacks Updates .

CloudformationResource

AWS::EC2::Instance

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html

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_ec2 as ec2

cfn_instance = ec2.CfnInstance(self, "MyCfnInstance",
    additional_info="additionalInfo",
    affinity="affinity",
    availability_zone="availabilityZone",
    block_device_mappings=[ec2.CfnInstance.BlockDeviceMappingProperty(
        device_name="deviceName",

        # the properties below are optional
        ebs=ec2.CfnInstance.EbsProperty(
            delete_on_termination=False,
            encrypted=False,
            iops=123,
            kms_key_id="kmsKeyId",
            snapshot_id="snapshotId",
            volume_size=123,
            volume_type="volumeType"
        ),
        no_device=ec2.CfnInstance.NoDeviceProperty(),
        virtual_name="virtualName"
    )],
    cpu_options=ec2.CfnInstance.CpuOptionsProperty(
        core_count=123,
        threads_per_core=123
    ),
    credit_specification=ec2.CfnInstance.CreditSpecificationProperty(
        cpu_credits="cpuCredits"
    ),
    disable_api_termination=False,
    ebs_optimized=False,
    elastic_gpu_specifications=[ec2.CfnInstance.ElasticGpuSpecificationProperty(
        type="type"
    )],
    elastic_inference_accelerators=[ec2.CfnInstance.ElasticInferenceAcceleratorProperty(
        type="type",

        # the properties below are optional
        count=123
    )],
    enclave_options=ec2.CfnInstance.EnclaveOptionsProperty(
        enabled=False
    ),
    hibernation_options=ec2.CfnInstance.HibernationOptionsProperty(
        configured=False
    ),
    host_id="hostId",
    host_resource_group_arn="hostResourceGroupArn",
    iam_instance_profile="iamInstanceProfile",
    image_id="imageId",
    instance_initiated_shutdown_behavior="instanceInitiatedShutdownBehavior",
    instance_type="instanceType",
    ipv6_address_count=123,
    ipv6_addresses=[ec2.CfnInstance.InstanceIpv6AddressProperty(
        ipv6_address="ipv6Address"
    )],
    kernel_id="kernelId",
    key_name="keyName",
    launch_template=ec2.CfnInstance.LaunchTemplateSpecificationProperty(
        version="version",

        # the properties below are optional
        launch_template_id="launchTemplateId",
        launch_template_name="launchTemplateName"
    ),
    license_specifications=[ec2.CfnInstance.LicenseSpecificationProperty(
        license_configuration_arn="licenseConfigurationArn"
    )],
    monitoring=False,
    network_interfaces=[ec2.CfnInstance.NetworkInterfaceProperty(
        device_index="deviceIndex",

        # the properties below are optional
        associate_carrier_ip_address=False,
        associate_public_ip_address=False,
        delete_on_termination=False,
        description="description",
        group_set=["groupSet"],
        ipv6_address_count=123,
        ipv6_addresses=[ec2.CfnInstance.InstanceIpv6AddressProperty(
            ipv6_address="ipv6Address"
        )],
        network_interface_id="networkInterfaceId",
        private_ip_address="privateIpAddress",
        private_ip_addresses=[ec2.CfnInstance.PrivateIpAddressSpecificationProperty(
            primary=False,
            private_ip_address="privateIpAddress"
        )],
        secondary_private_ip_address_count=123,
        subnet_id="subnetId"
    )],
    placement_group_name="placementGroupName",
    private_dns_name_options=ec2.CfnInstance.PrivateDnsNameOptionsProperty(
        enable_resource_name_dns_aaaa_record=False,
        enable_resource_name_dns_aRecord=False,
        hostname_type="hostnameType"
    ),
    private_ip_address="privateIpAddress",
    propagate_tags_to_volume_on_creation=False,
    ramdisk_id="ramdiskId",
    security_group_ids=["securityGroupIds"],
    security_groups=["securityGroups"],
    source_dest_check=False,
    ssm_associations=[ec2.CfnInstance.SsmAssociationProperty(
        document_name="documentName",

        # the properties below are optional
        association_parameters=[ec2.CfnInstance.AssociationParameterProperty(
            key="key",
            value=["value"]
        )]
    )],
    subnet_id="subnetId",
    tags=[CfnTag(
        key="key",
        value="value"
    )],
    tenancy="tenancy",
    user_data="userData",
    volumes=[ec2.CfnInstance.VolumeProperty(
        device="device",
        volume_id="volumeId"
    )]
)

Create a new AWS::EC2::Instance.

Parameters
  • scope (Construct) –

    • scope in which this resource is defined.

  • id (str) –

    • scoped id of the resource.

  • additional_info (Optional[str]) – This property is reserved for internal use. If you use it, the stack fails with this error: Bad property set: [Testing this property] (Service: AmazonEC2; Status Code: 400; Error Code: InvalidParameterCombination; Request ID: 0XXXXXX-49c7-4b40-8bcc-76885dcXXXXX) .

  • affinity (Optional[str]) – Indicates whether the instance is associated with a dedicated host. If you want the instance to always restart on the same host on which it was launched, specify host . If you want the instance to restart on any available host, but try to launch onto the last host it ran on (on a best-effort basis), specify default .

  • availability_zone (Optional[str]) – The Availability Zone of the instance. If not specified, an Availability Zone will be automatically chosen for you based on the load balancing criteria for the Region. This parameter is not supported by DescribeImageAttribute .

  • block_device_mappings (Union[IResolvable, Sequence[Union[IResolvable, BlockDeviceMappingProperty, Dict[str, Any]]], None]) – The block device mapping entries that defines the block devices to attach to the instance at launch. By default, the block devices specified in the block device mapping for the AMI are used. You can override the AMI block device mapping using the instance block device mapping. For the root volume, you can override only the volume size, volume type, volume encryption settings, and the DeleteOnTermination setting. .. epigraph:: After the instance is running, you can modify only the DeleteOnTermination parameter for the attached volumes without interrupting the instance. Modifying any other parameter results in instance replacement .

  • cpu_options (Union[IResolvable, CpuOptionsProperty, Dict[str, Any], None]) – The CPU options for the instance. For more information, see Optimize CPU options in the Amazon Elastic Compute Cloud User Guide .

  • credit_specification (Union[IResolvable, CreditSpecificationProperty, Dict[str, Any], None]) – The credit option for CPU usage of the burstable performance instance. Valid values are standard and unlimited . To change this attribute after launch, use ModifyInstanceCreditSpecification . For more information, see Burstable performance instances in the Amazon EC2 User Guide . Default: standard (T2 instances) or unlimited (T3/T3a instances) For T3 instances with host tenancy, only standard is supported.

  • disable_api_termination (Union[bool, IResolvable, None]) – 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 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

  • ebs_optimized (Union[bool, IResolvable, None]) – Indicates whether the instance is optimized for Amazon EBS I/O. This optimization provides dedicated throughput to Amazon EBS and an optimized configuration stack to provide optimal Amazon 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

  • elastic_gpu_specifications (Union[IResolvable, Sequence[Union[IResolvable, ElasticGpuSpecificationProperty, Dict[str, Any]]], None]) – An elastic GPU to associate with the instance. An Elastic GPU is a GPU resource that you can attach to your Windows instance to accelerate the graphics performance of your applications. For more information, see Amazon EC2 Elastic GPUs in the Amazon EC2 User Guide .

  • elastic_inference_accelerators (Union[IResolvable, Sequence[Union[IResolvable, ElasticInferenceAcceleratorProperty, Dict[str, Any]]], None]) – An elastic inference accelerator to associate with the instance. Elastic inference accelerators are a resource you can attach to your Amazon EC2 instances to accelerate your Deep Learning (DL) inference workloads. You cannot specify accelerators from different generations in the same request.

  • enclave_options (Union[IResolvable, EnclaveOptionsProperty, Dict[str, Any], None]) – Indicates whether the instance is enabled for AWS Nitro Enclaves.

  • hibernation_options (Union[IResolvable, HibernationOptionsProperty, Dict[str, Any], None]) – Indicates whether an instance is enabled for hibernation. For more information, see Hibernate your instance in the Amazon EC2 User Guide . You can’t enable hibernation and AWS Nitro Enclaves on the same instance.

  • host_id (Optional[str]) – If you specify host for the Affinity property, the ID of a dedicated host that the instance is associated with. If you don’t specify an ID, Amazon EC2 launches the instance onto any available, compatible dedicated host in your account. This type of launch is called an untargeted launch. Note that for untargeted launches, you must have a compatible, dedicated host available to successfully launch instances.

  • host_resource_group_arn (Optional[str]) – The ARN of the host resource group in which to launch the instances. If you specify a host resource group ARN, omit the Tenancy parameter or set it to host .

  • iam_instance_profile (Optional[str]) – The name of an IAM instance profile. To create a new IAM instance profile, use the AWS::IAM::InstanceProfile resource.

  • image_id (Optional[str]) – The ID of the AMI. An AMI ID is required to launch an instance and must be specified here or in a launch template.

  • instance_initiated_shutdown_behavior (Optional[str]) – Indicates whether an instance stops or terminates when you initiate shutdown from the instance (using the operating system command for system shutdown). Default: stop

  • instance_type (Optional[str]) – The instance type. For more information, see Instance types in the Amazon EC2 User Guide . Default: m1.small

  • ipv6_address_count (Union[int, float, None]) – [EC2-VPC] The 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. You cannot specify this option and the network interfaces option in the same request.

  • ipv6_addresses (Union[IResolvable, Sequence[Union[IResolvable, InstanceIpv6AddressProperty, Dict[str, Any]]], None]) – [EC2-VPC] The 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. You cannot specify this option and the network interfaces option in the same request.

  • kernel_id (Optional[str]) – The ID of the kernel. .. epigraph:: We recommend that you use PV-GRUB instead of kernels and RAM disks. For more information, see PV-GRUB in the Amazon EC2 User Guide .

  • key_name (Optional[str]) – The name of the key pair. You can create a key pair using CreateKeyPair or ImportKeyPair . .. 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.

  • launch_template (Union[IResolvable, LaunchTemplateSpecificationProperty, Dict[str, Any], None]) – The launch template to use to launch the instances. Any parameters that you specify in the AWS CloudFormation template override the same parameters in the launch template. You can specify either the name or ID of a launch template, but not both.

  • license_specifications (Union[IResolvable, Sequence[Union[IResolvable, LicenseSpecificationProperty, Dict[str, Any]]], None]) – The license configurations.

  • monitoring (Union[bool, IResolvable, None]) – Specifies whether detailed monitoring is enabled for the instance. Specify true to enable detailed monitoring. Otherwise, basic monitoring is enabled. For more information about detailed monitoring, see Enable or turn off detailed monitoring for your instances in the Amazon EC2 User Guide .

  • network_interfaces (Union[IResolvable, Sequence[Union[IResolvable, NetworkInterfaceProperty, Dict[str, Any]]], None]) – The network interfaces to associate with the instance. .. epigraph:: If you use this property to point to a network interface, you must terminate the original interface before attaching a new one to allow the update of the instance to succeed. If this resource has a public IP address and is also in a VPC that is defined in the same template, you must use the DependsOn Attribute to declare a dependency on the VPC-gateway attachment.

  • placement_group_name (Optional[str]) – The name of an existing placement group that you want to launch the instance into (cluster | partition | spread).

  • private_dns_name_options (Union[IResolvable, PrivateDnsNameOptionsProperty, Dict[str, Any], None]) – The options for the instance hostname.

  • private_ip_address (Optional[str]) – [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. You cannot specify this option and the network interfaces option in the same request. If you make an update to an instance that requires replacement, you must assign a new private IP address. During a replacement, AWS CloudFormation creates a new instance but doesn’t delete the old instance until the stack has successfully updated. If the stack update fails, AWS CloudFormation uses the old instance to roll back the stack to the previous working state. The old and new instances cannot have the same private IP address.

  • propagate_tags_to_volume_on_creation (Union[bool, IResolvable, None]) – Indicates whether to assign the tags from the instance to all of the volumes attached to the instance at launch. If you specify true and you assign tags to the instance, those tags are automatically assigned to all of the volumes that you attach to the instance at launch. If you specify false , those tags are not assigned to the attached volumes.

  • ramdisk_id (Optional[str]) –

    The ID of the RAM disk to select. Some kernels require additional drivers at launch. Check the kernel requirements for information about whether you need to specify a RAM disk. To find kernel requirements, go to the AWS Resource Center and search for the kernel ID. .. epigraph:: We recommend that you use PV-GRUB instead of kernels and RAM disks. For more information, see PV-GRUB in the Amazon EC2 User Guide .

  • security_group_ids (Optional[Sequence[str]]) – The IDs of the security groups. You can create a security group using CreateSecurityGroup . If you specify a network interface, you must specify any security groups as part of the network interface.

  • security_groups (Optional[Sequence[str]]) – [EC2-Classic, default VPC] The names of the security groups. For a nondefault VPC, you must use security group IDs instead. You cannot specify this option and the network interfaces option in the same request. The list can contain both the name of existing Amazon EC2 security groups or references to AWS::EC2::SecurityGroup resources created in the template. Default: Amazon EC2 uses the default security group.

  • source_dest_check (Union[bool, IResolvable, None]) – Enable or disable source/destination checks, which ensure that the instance is either the source or the destination of any traffic that it receives. If the value is true , source/destination checks are enabled; otherwise, they are disabled. The default value is true . You must disable source/destination checks if the instance runs services such as network address translation, routing, or firewalls.

  • ssm_associations (Union[IResolvable, Sequence[Union[IResolvable, SsmAssociationProperty, Dict[str, Any]]], None]) – The SSM document and parameter values in AWS Systems Manager to associate with this instance. To use this property, you must specify an IAM instance profile role for the instance. For more information, see Create an Instance Profile for Systems Manager in the AWS Systems Manager User Guide . .. epigraph:: You can currently associate only one document with an instance.

  • subnet_id (Optional[str]) – [EC2-VPC] The ID of the subnet to launch the instance into. If you specify a network interface, you must specify any subnets as part of the network interface.

  • tags (Optional[Sequence[Union[CfnTag, Dict[str, Any]]]]) – The tags to add to the instance. These tags are not applied to the EBS volumes, such as the root volume.

  • tenancy (Optional[str]) – The tenancy of the instance (if the instance is running in a VPC). An instance with a tenancy of dedicated runs on single-tenant hardware.

  • user_data (Optional[str]) – The user data script to make available to the instance. For more information, see Run commands on your Linux instance at launch and Run commands on your Windows instance at launch . 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.

  • volumes (Union[IResolvable, Sequence[Union[IResolvable, VolumeProperty, Dict[str, Any]]], None]) – The volumes to attach to the instance.

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 prefix path 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 to addOverride 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: true

  • default (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

Reference

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::EC2::Instance'
additional_info

This property is reserved for internal use.

If you use it, the stack fails with this error: Bad property set: [Testing this property] (Service: AmazonEC2; Status Code: 400; Error Code: InvalidParameterCombination; Request ID: 0XXXXXX-49c7-4b40-8bcc-76885dcXXXXX) .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-additionalinfo

Return type

Optional[str]

affinity

Indicates whether the instance is associated with a dedicated host.

If you want the instance to always restart on the same host on which it was launched, specify host . If you want the instance to restart on any available host, but try to launch onto the last host it ran on (on a best-effort basis), specify default .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-affinity

Return type

Optional[str]

attr_availability_zone

us-east-1b .

You can retrieve a list of all Availability Zones for a Region by using the Fn::GetAZs intrinsic function.

CloudformationAttribute

AvailabilityZone

Type

The Availability Zone where the specified instance is launched. For example

Return type

str

attr_private_dns_name

The private DNS name of the specified instance.

For example: ip-10-24-34-0.ec2.internal .

CloudformationAttribute

PrivateDnsName

Return type

str

attr_private_ip

The private IP address of the specified instance.

For example: 10.24.34.0 .

CloudformationAttribute

PrivateIp

Return type

str

attr_public_dns_name

The public DNS name of the specified instance.

For example: ec2-107-20-50-45.compute-1.amazonaws.com .

CloudformationAttribute

PublicDnsName

Return type

str

attr_public_ip

The public IP address of the specified instance.

For example: 192.0.2.0 .

CloudformationAttribute

PublicIp

Return type

str

availability_zone

The Availability Zone of the instance.

If not specified, an Availability Zone will be automatically chosen for you based on the load balancing criteria for the Region.

This parameter is not supported by DescribeImageAttribute .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-availabilityzone

Return type

Optional[str]

block_device_mappings

The block device mapping entries that defines the block devices to attach to the instance at launch.

By default, the block devices specified in the block device mapping for the AMI are used. You can override the AMI block device mapping using the instance block device mapping. For the root volume, you can override only the volume size, volume type, volume encryption settings, and the DeleteOnTermination setting. .. epigraph:

After the instance is running, you can modify only the ``DeleteOnTermination`` parameter for the attached volumes without interrupting the instance. Modifying any other parameter results in instance `replacement <https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement>`_ .
Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-blockdevicemappings

Return type

Union[IResolvable, List[Union[IResolvable, BlockDeviceMappingProperty]], None]

cfn_options

Options for this resource, such as condition, update policy etc.

Return type

ICfnResourceOptions

cfn_resource_type

AWS resource type.

Return type

str

cpu_options

The CPU options for the instance.

For more information, see Optimize CPU options in the Amazon Elastic Compute Cloud User Guide .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-cpuoptions

Return type

Union[IResolvable, CpuOptionsProperty, None]

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]

credit_specification

The credit option for CPU usage of the burstable performance instance.

Valid values are standard and unlimited . To change this attribute after launch, use ModifyInstanceCreditSpecification . For more information, see Burstable performance instances in the Amazon EC2 User Guide .

Default: standard (T2 instances) or unlimited (T3/T3a instances)

For T3 instances with host tenancy, only standard is supported.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-creditspecification

Return type

Union[IResolvable, CreditSpecificationProperty, None]

disable_api_termination

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 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

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-disableapitermination

Return type

Union[bool, IResolvable, None]

ebs_optimized

Indicates whether the instance is optimized for Amazon EBS I/O.

This optimization provides dedicated throughput to Amazon EBS and an optimized configuration stack to provide optimal Amazon 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

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-ebsoptimized

Return type

Union[bool, IResolvable, None]

elastic_gpu_specifications

An elastic GPU to associate with the instance.

An Elastic GPU is a GPU resource that you can attach to your Windows instance to accelerate the graphics performance of your applications. For more information, see Amazon EC2 Elastic GPUs in the Amazon EC2 User Guide .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-elasticgpuspecifications

Return type

Union[IResolvable, List[Union[IResolvable, ElasticGpuSpecificationProperty]], None]

elastic_inference_accelerators

An elastic inference accelerator to associate with the instance.

Elastic inference accelerators are a resource you can attach to your Amazon EC2 instances to accelerate your Deep Learning (DL) inference workloads.

You cannot specify accelerators from different generations in the same request.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-elasticinferenceaccelerators

Return type

Union[IResolvable, List[Union[IResolvable, ElasticInferenceAcceleratorProperty]], None]

enclave_options

Indicates whether the instance is enabled for AWS Nitro Enclaves.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-enclaveoptions

Return type

Union[IResolvable, EnclaveOptionsProperty, None]

hibernation_options

Indicates whether an instance is enabled for hibernation.

For more information, see Hibernate your instance in the Amazon EC2 User Guide .

You can’t enable hibernation and AWS Nitro Enclaves on the same instance.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-hibernationoptions

Return type

Union[IResolvable, HibernationOptionsProperty, None]

host_id

If you specify host for the Affinity property, the ID of a dedicated host that the instance is associated with.

If you don’t specify an ID, Amazon EC2 launches the instance onto any available, compatible dedicated host in your account. This type of launch is called an untargeted launch. Note that for untargeted launches, you must have a compatible, dedicated host available to successfully launch instances.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-hostid

Return type

Optional[str]

host_resource_group_arn

The ARN of the host resource group in which to launch the instances.

If you specify a host resource group ARN, omit the Tenancy parameter or set it to host .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-hostresourcegrouparn

Return type

Optional[str]

iam_instance_profile

The name of an IAM instance profile.

To create a new IAM instance profile, use the AWS::IAM::InstanceProfile resource.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-iaminstanceprofile

Return type

Optional[str]

image_id

The ID of the AMI.

An AMI ID is required to launch an instance and must be specified here or in a launch template.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-imageid

Return type

Optional[str]

instance_initiated_shutdown_behavior

Indicates whether an instance stops or terminates when you initiate shutdown from the instance (using the operating system command for system shutdown).

Default: stop

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-instanceinitiatedshutdownbehavior

Return type

Optional[str]

instance_type

//docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html>`_ in the Amazon EC2 User Guide .

Default: m1.small

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-instancetype

Type

The instance type. For more information, see `Instance types <https

Return type

Optional[str]

ipv6_address_count

[EC2-VPC] The 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.

You cannot specify this option and the network interfaces option in the same request.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-ipv6addresscount

Return type

Union[int, float, None]

ipv6_addresses

[EC2-VPC] The 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.

You cannot specify this option and the network interfaces option in the same request.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-ipv6addresses

Return type

Union[IResolvable, List[Union[IResolvable, InstanceIpv6AddressProperty]], None]

kernel_id

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 EC2 User Guide .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-kernelid

Return type

Optional[str]

key_name

//docs.aws.amazon.com/AWSEC2/latest/APIReference/API_ImportKeyPair.html>`_ .

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.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-keyname

Type

The name of the key pair. You can create a key pair using `CreateKeyPair <https

Type

//docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CreateKeyPair.html>`_ or `ImportKeyPair <https

Return type

Optional[str]

launch_template

The launch template to use to launch the instances.

Any parameters that you specify in the AWS CloudFormation template override the same parameters in the launch template. You can specify either the name or ID of a launch template, but not both.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-launchtemplate

Return type

Union[IResolvable, LaunchTemplateSpecificationProperty, None]

license_specifications

The license configurations.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-licensespecifications

Return type

Union[IResolvable, List[Union[IResolvable, LicenseSpecificationProperty]], None]

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.

monitoring

Specifies whether detailed monitoring is enabled for the instance.

Specify true to enable detailed monitoring. Otherwise, basic monitoring is enabled. For more information about detailed monitoring, see Enable or turn off detailed monitoring for your instances in the Amazon EC2 User Guide .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-monitoring

Return type

Union[bool, IResolvable, None]

network_interfaces

The network interfaces to associate with the instance.

If you use this property to point to a network interface, you must terminate the original interface before attaching a new one to allow the update of the instance to succeed.

If this resource has a public IP address and is also in a VPC that is defined in the same template, you must use the DependsOn Attribute to declare a dependency on the VPC-gateway attachment.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-networkinterfaces

Return type

Union[IResolvable, List[Union[IResolvable, NetworkInterfaceProperty]], None]

node

The construct tree node associated with this construct.

Return type

ConstructNode

placement_group_name

The name of an existing placement group that you want to launch the instance into (cluster | partition | spread).

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-placementgroupname

Return type

Optional[str]

private_dns_name_options

The options for the instance hostname.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-privatednsnameoptions

Return type

Union[IResolvable, PrivateDnsNameOptionsProperty, None]

private_ip_address

[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.

You cannot specify this option and the network interfaces option in the same request.

If you make an update to an instance that requires replacement, you must assign a new private IP address. During a replacement, AWS CloudFormation creates a new instance but doesn’t delete the old instance until the stack has successfully updated. If the stack update fails, AWS CloudFormation uses the old instance to roll back the stack to the previous working state. The old and new instances cannot have the same private IP address.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-privateipaddress

Return type

Optional[str]

propagate_tags_to_volume_on_creation

Indicates whether to assign the tags from the instance to all of the volumes attached to the instance at launch.

If you specify true and you assign tags to the instance, those tags are automatically assigned to all of the volumes that you attach to the instance at launch. If you specify false , those tags are not assigned to the attached volumes.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-propagatetagstovolumeoncreation

Return type

Union[bool, IResolvable, None]

ramdisk_id

The ID of the RAM disk to select.

Some kernels require additional drivers at launch. Check the kernel requirements for information about whether you need to specify a RAM disk. To find kernel requirements, go to the AWS Resource Center and search for the kernel ID. .. epigraph:

We recommend that you use PV-GRUB instead of kernels and RAM disks. For more information, see `PV-GRUB <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/UserProvidedkernels.html>`_ in the *Amazon EC2 User Guide* .
Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-ramdiskid

Return type

Optional[str]

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_group_ids

//docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CreateSecurityGroup.html>`_ .

If you specify a network interface, you must specify any security groups as part of the network interface.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-securitygroupids

Type

The IDs of the security groups. You can create a security group using `CreateSecurityGroup <https

Return type

Optional[List[str]]

security_groups

[EC2-Classic, default VPC] The names of the security groups.

For a nondefault VPC, you must use security group IDs instead.

You cannot specify this option and the network interfaces option in the same request. The list can contain both the name of existing Amazon EC2 security groups or references to AWS::EC2::SecurityGroup resources created in the template.

Default: Amazon EC2 uses the default security group.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-securitygroups

Return type

Optional[List[str]]

source_dest_check

Enable or disable source/destination checks, which ensure that the instance is either the source or the destination of any traffic that it receives.

If the value is true , source/destination checks are enabled; otherwise, they are disabled. The default value is true . You must disable source/destination checks if the instance runs services such as network address translation, routing, or firewalls.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-sourcedestcheck

Return type

Union[bool, IResolvable, None]

ssm_associations

//docs.aws.amazon.com/systems-manager/latest/userguide/sysman-configuring-access-role.html>`_ in the AWS Systems Manager User Guide .

You can currently associate only one document with an instance.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-ssmassociations

Type

The SSM `document <https

Type

//docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-document.html>`_ and parameter values in AWS Systems Manager to associate with this instance. To use this property, you must specify an IAM instance profile role for the instance. For more information, see `Create an Instance Profile for Systems Manager <https

Return type

Union[IResolvable, List[Union[IResolvable, SsmAssociationProperty]], None]

stack

The stack in which this element is defined.

CfnElements must be defined within a stack scope (directly or indirectly).

Return type

Stack

subnet_id

[EC2-VPC] The ID of the subnet to launch the instance into.

If you specify a network interface, you must specify any subnets as part of the network interface.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-subnetid

Return type

Optional[str]

tags

The tags to add to the instance.

These tags are not applied to the EBS volumes, such as the root volume.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-tags

Return type

TagManager

tenancy

The tenancy of the instance (if the instance is running in a VPC).

An instance with a tenancy of dedicated runs on single-tenant hardware.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-tenancy

Return type

Optional[str]

user_data

The user data script to make available to the instance.

For more information, see Run commands on your Linux instance at launch and Run commands on your Windows instance at launch . 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.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-userdata

Return type

Optional[str]

volumes

The volumes to attach to the instance.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-volumes

Return type

Union[IResolvable, List[Union[IResolvable, VolumeProperty]], None]

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

AssociationParameterProperty

class CfnInstance.AssociationParameterProperty(*, key, value)

Bases: object

Specifies input parameter values for an SSM document in AWS Systems Manager .

AssociationParameter is a property of the Amazon EC2 Instance SsmAssociation property.

Parameters
  • key (str) – The name of an input parameter that is in the associated SSM document.

  • value (Sequence[str]) – The value of an input parameter.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance-ssmassociations-associationparameters.html

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_ec2 as ec2

association_parameter_property = ec2.CfnInstance.AssociationParameterProperty(
    key="key",
    value=["value"]
)

Attributes

key

The name of an input parameter that is in the associated SSM document.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance-ssmassociations-associationparameters.html#cfn-ec2-instance-ssmassociations-associationparameters-key

Return type

str

value

The value of an input parameter.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance-ssmassociations-associationparameters.html#cfn-ec2-instance-ssmassociations-associationparameters-value

Return type

List[str]

BlockDeviceMappingProperty

class CfnInstance.BlockDeviceMappingProperty(*, device_name, ebs=None, no_device=None, virtual_name=None)

Bases: object

Specifies a block device mapping for an instance.

You must specify exactly one of the following properties: VirtualName , Ebs , or NoDevice .

BlockDeviceMapping is a property of the AWS::EC2::Instance resource. .. epigraph:

After the instance is running, you can modify only the ``DeleteOnTermination`` parameter for the attached volumes without interrupting the instance. Modifying any other parameter results in instance `replacement <https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement>`_ .
Parameters
  • device_name (str) – The device name (for example, /dev/sdh or xvdh ). .. epigraph:: After the instance is running, this parameter is used to specify the device name of the block device mapping to update.

  • ebs (Union[IResolvable, EbsProperty, Dict[str, Any], None]) –

    Parameters used to automatically set up EBS volumes when the instance is launched. .. epigraph:: After the instance is running, you can modify only the DeleteOnTermination parameter for the attached volumes without interrupting the instance. Modifying any other parameter results in instance replacement .

  • no_device (Union[IResolvable, NoDeviceProperty, Dict[str, Any], None]) –

    To omit the device from the block device mapping, specify an empty string. .. epigraph:: After the instance is running, modifying this parameter results in instance replacement .

  • virtual_name (Optional[str]) –

    The virtual device name ( ephemeral N). The name must be in the form ephemeral X where X is a number starting from zero (0). For example, an instance type with 2 available instance store volumes can specify mappings for ephemeral0 and ephemeral1 . The number of available instance store volumes depends on the instance type. After you connect to the instance, you must mount the volume. NVMe instance store volumes are automatically enumerated and assigned a device name. Including them in your block device mapping has no effect. Constraints : For M3 instances, you must specify instance store volumes in the block device mapping for the instance. When you launch an M3 instance, we ignore any instance store volumes specified in the block device mapping for the AMI. .. epigraph:: After the instance is running, modifying this parameter results in instance replacement .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-blockdev-mapping.html

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_ec2 as ec2

block_device_mapping_property = ec2.CfnInstance.BlockDeviceMappingProperty(
    device_name="deviceName",

    # the properties below are optional
    ebs=ec2.CfnInstance.EbsProperty(
        delete_on_termination=False,
        encrypted=False,
        iops=123,
        kms_key_id="kmsKeyId",
        snapshot_id="snapshotId",
        volume_size=123,
        volume_type="volumeType"
    ),
    no_device=ec2.CfnInstance.NoDeviceProperty(),
    virtual_name="virtualName"
)

Attributes

device_name

The device name (for example, /dev/sdh or xvdh ).

After the instance is running, this parameter is used to specify the device name of the block device mapping to update.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-blockdev-mapping.html#cfn-ec2-blockdev-mapping-devicename

Return type

str

ebs

Parameters used to automatically set up EBS volumes when the instance is launched.

After the instance is running, you can modify only the DeleteOnTermination parameter for the attached volumes without interrupting the instance. Modifying any other parameter results in instance replacement .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-blockdev-mapping.html#cfn-ec2-blockdev-mapping-ebs

Return type

Union[IResolvable, EbsProperty, None]

no_device

To omit the device from the block device mapping, specify an empty string.

After the instance is running, modifying this parameter results in instance replacement .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-blockdev-mapping.html#cfn-ec2-blockdev-mapping-nodevice

Return type

Union[IResolvable, NoDeviceProperty, None]

virtual_name

The virtual device name ( ephemeral N).

The name must be in the form ephemeral X where X is a number starting from zero (0). For example, an instance type with 2 available instance store volumes can specify mappings for ephemeral0 and ephemeral1 . The number of available instance store volumes depends on the instance type. After you connect to the instance, you must mount the volume.

NVMe instance store volumes are automatically enumerated and assigned a device name. Including them in your block device mapping has no effect.

Constraints : For M3 instances, you must specify instance store volumes in the block device mapping for the instance. When you launch an M3 instance, we ignore any instance store volumes specified in the block device mapping for the AMI. .. epigraph:

After the instance is running, modifying this parameter results in instance `replacement <https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement>`_ .
Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-blockdev-mapping.html#cfn-ec2-blockdev-mapping-virtualname

Return type

Optional[str]

CpuOptionsProperty

class CfnInstance.CpuOptionsProperty(*, core_count=None, threads_per_core=None)

Bases: object

Specifies the CPU options for the instance.

When you specify CPU options, you must specify both the number of CPU cores and threads per core.

For more information, see Optimize CPU options in the Amazon Elastic Compute Cloud User Guide .

Parameters
  • core_count (Union[int, float, None]) – The number of CPU cores for the instance.

  • threads_per_core (Union[int, float, None]) – The number of threads per CPU core.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance-cpuoptions.html

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_ec2 as ec2

cpu_options_property = ec2.CfnInstance.CpuOptionsProperty(
    core_count=123,
    threads_per_core=123
)

Attributes

core_count

The number of CPU cores for the instance.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance-cpuoptions.html#cfn-ec2-instance-cpuoptions-corecount

Return type

Union[int, float, None]

threads_per_core

The number of threads per CPU core.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance-cpuoptions.html#cfn-ec2-instance-cpuoptions-threadspercore

Return type

Union[int, float, None]

CreditSpecificationProperty

class CfnInstance.CreditSpecificationProperty(*, cpu_credits=None)

Bases: object

Specifies the credit option for CPU usage of a T2, T3, or T3a instance.

CreditSpecification is a property of the AWS::EC2::Instance resource.

Parameters

cpu_credits (Optional[str]) – The credit option for CPU usage of the instance. Valid values are standard and unlimited . T3 instances launch as unlimited by default. T2 instances launch as standard by default.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance-creditspecification.html

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_ec2 as ec2

credit_specification_property = ec2.CfnInstance.CreditSpecificationProperty(
    cpu_credits="cpuCredits"
)

Attributes

cpu_credits

The credit option for CPU usage of the instance.

Valid values are standard and unlimited . T3 instances launch as unlimited by default. T2 instances launch as standard by default.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance-creditspecification.html#cfn-ec2-instance-creditspecification-cpucredits

Return type

Optional[str]

EbsProperty

class CfnInstance.EbsProperty(*, delete_on_termination=None, encrypted=None, iops=None, kms_key_id=None, snapshot_id=None, volume_size=None, volume_type=None)

Bases: object

Specifies a block device for an EBS volume.

Ebs is a property of the Amazon EC2 BlockDeviceMapping property. .. epigraph:

After the instance is running, you can modify only the ``DeleteOnTermination`` parameters for the attached volumes without interrupting the instance. Modifying any other parameter results in instance `replacement <https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement>`_ .
Parameters
  • delete_on_termination (Union[bool, IResolvable, None]) – Indicates whether the EBS volume is deleted on instance termination. For more information, see Preserving Amazon EBS volumes on instance termination in the Amazon EC2 User Guide .

  • encrypted (Union[bool, IResolvable, None]) –

    Indicates whether the volume should be encrypted. The effect of setting the encryption state to true depends on the volume origin (new or from a snapshot), starting encryption state, ownership, and whether encryption by default is enabled. For more information, see Encryption by default in the Amazon Elastic Compute Cloud User Guide . Encrypted Amazon EBS volumes must be attached to instances that support Amazon EBS encryption. For more information, see Supported instance types . .. epigraph:: After the instance is running, modifying this parameter results in instance replacement .

  • iops (Union[int, float, None]) –

    The number of I/O operations per second (IOPS). For gp3 , io1 , and io2 volumes, this represents the number of IOPS that are provisioned for the volume. For gp2 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 - io2 : 100-64,000 IOPS For io1 and io2 volumes, we guarantee 64,000 IOPS only for Instances built on the Nitro System . Other instance families guarantee performance up to 32,000 IOPS. This parameter is required for io1 and io2 volumes. The default for gp3 volumes is 3,000 IOPS. This parameter is not supported for gp2 , st1 , sc1 , or standard volumes. .. epigraph:: After the instance is running, modifying this parameter results in instance replacement .

  • kms_key_id (Optional[str]) –

    The identifier of the AWS KMS key to use for Amazon EBS encryption. If KmsKeyId is specified, the encrypted state must be true . If the encrypted state is true but you do not specify KmsKeyId , your KMS key for EBS is used. You can specify the KMS key using any of the following: - Key ID. For example, 1234abcd-12ab-34cd-56ef-1234567890ab. - Key alias. For example, alias/ExampleAlias. - Key ARN. For example, arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab. - Alias ARN. For example, arn:aws:kms:us-west-2:111122223333:alias/ExampleAlias. .. epigraph:: After the instance is running, modifying this parameter results in instance replacement .

  • snapshot_id (Optional[str]) –

    The ID of the snapshot. If you specify both SnapshotId and VolumeSize , VolumeSize must be equal or greater than the size of the snapshot. .. epigraph:: After the instance is running, modifying this parameter results in instance replacement .

  • volume_size (Union[int, float, None]) –

    The size of the volume, in GiBs. You must specify either a snapshot ID or a volume size. If you specify a snapshot, the default is the snapshot size. You can specify a volume size that is equal to or larger than the snapshot size. The following are the supported volumes sizes for each volume type: - gp2 and gp3 :1-16,384 - io1 and io2 : 4-16,384 - st1 and sc1 : 125-16,384 - standard : 1-1,024 .. epigraph:: After the instance is running, modifying this parameter results in instance replacement .

  • volume_type (Optional[str]) –

    The volume type. For more information, see Amazon EBS volume types in the Amazon EC2 User Guide . If the volume type is io1 or io2 , you must specify the IOPS that the volume supports. .. epigraph:: After the instance is running, modifying this parameter results in instance replacement .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-blockdev-template.html

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_ec2 as ec2

ebs_property = ec2.CfnInstance.EbsProperty(
    delete_on_termination=False,
    encrypted=False,
    iops=123,
    kms_key_id="kmsKeyId",
    snapshot_id="snapshotId",
    volume_size=123,
    volume_type="volumeType"
)

Attributes

delete_on_termination

Indicates whether the EBS volume is deleted on instance termination.

For more information, see Preserving Amazon EBS volumes on instance termination in the Amazon EC2 User Guide .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-blockdev-template.html#cfn-ec2-blockdev-template-deleteontermination

Return type

Union[bool, IResolvable, None]

encrypted

Indicates whether the volume should be encrypted.

The effect of setting the encryption state to true depends on the volume origin (new or from a snapshot), starting encryption state, ownership, and whether encryption by default is enabled. For more information, see Encryption by default in the Amazon Elastic Compute Cloud User Guide .

Encrypted Amazon EBS volumes must be attached to instances that support Amazon EBS encryption. For more information, see Supported instance types . .. epigraph:

After the instance is running, modifying this parameter results in instance `replacement <https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement>`_ .
Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-blockdev-template.html#cfn-ec2-blockdev-template-encrypted

Return type

Union[bool, IResolvable, None]

iops

The number of I/O operations per second (IOPS).

For gp3 , io1 , and io2 volumes, this represents the number of IOPS that are provisioned for the volume. For gp2 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

  • io2 : 100-64,000 IOPS

For io1 and io2 volumes, we guarantee 64,000 IOPS only for Instances built on the Nitro System . Other instance families guarantee performance up to 32,000 IOPS.

This parameter is required for io1 and io2 volumes. The default for gp3 volumes is 3,000 IOPS. This parameter is not supported for gp2 , st1 , sc1 , or standard volumes. .. epigraph:

After the instance is running, modifying this parameter results in instance `replacement <https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement>`_ .
Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-blockdev-template.html#cfn-ec2-blockdev-template-iops

Return type

Union[int, float, None]

kms_key_id

The identifier of the AWS KMS key to use for Amazon EBS encryption.

If KmsKeyId is specified, the encrypted state must be true . If the encrypted state is true but you do not specify KmsKeyId , your KMS key for EBS is used.

You can specify the KMS key using any of the following:

  • Key ID. For example, 1234abcd-12ab-34cd-56ef-1234567890ab.

  • Key alias. For example, alias/ExampleAlias.

  • Key ARN. For example, arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab.

  • Alias ARN. For example, arn:aws:kms:us-west-2:111122223333:alias/ExampleAlias.

After the instance is running, modifying this parameter results in instance replacement .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-blockdev-template.html#cfn-ec2-instance-ebs-kmskeyid

Return type

Optional[str]

snapshot_id

The ID of the snapshot.

If you specify both SnapshotId and VolumeSize , VolumeSize must be equal or greater than the size of the snapshot. .. epigraph:

After the instance is running, modifying this parameter results in instance `replacement <https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement>`_ .
Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-blockdev-template.html#cfn-ec2-blockdev-template-snapshotid

Return type

Optional[str]

volume_size

The size of the volume, in GiBs.

You must specify either a snapshot ID or a volume size. If you specify a snapshot, the default is the snapshot size. You can specify a volume size that is equal to or larger than the snapshot size.

The following are the supported volumes sizes for each volume type:

  • gp2 and gp3 :1-16,384

  • io1 and io2 : 4-16,384

  • st1 and sc1 : 125-16,384

  • standard : 1-1,024

After the instance is running, modifying this parameter results in instance replacement .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-blockdev-template.html#cfn-ec2-blockdev-template-volumesize

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 . If the volume type is io1 or io2 , you must specify the IOPS that the volume supports. .. epigraph:

After the instance is running, modifying this parameter results in instance `replacement <https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement>`_ .
Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-blockdev-template.html#cfn-ec2-blockdev-template-volumetype

Return type

Optional[str]

ElasticGpuSpecificationProperty

class CfnInstance.ElasticGpuSpecificationProperty(*, type)

Bases: object

Specifies the type of Elastic GPU.

An Elastic GPU is a GPU resource that you can attach to your Amazon EC2 instance to accelerate the graphics performance of your applications. For more information, see Amazon EC2 Elastic GPUs in the Amazon EC2 User Guide for Windows Instances .

ElasticGpuSpecification is a property of the AWS::EC2::Instance resource.

Parameters

type (str) – The type of Elastic Graphics accelerator. For more information about the values to specify for Type , see Elastic Graphics Basics , specifically the Elastic Graphics accelerator column, in the Amazon Elastic Compute Cloud User Guide for Windows Instances .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance-elasticgpuspecification.html

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_ec2 as ec2

elastic_gpu_specification_property = ec2.CfnInstance.ElasticGpuSpecificationProperty(
    type="type"
)

Attributes

type

The type of Elastic Graphics accelerator.

For more information about the values to specify for Type , see Elastic Graphics Basics , specifically the Elastic Graphics accelerator column, in the Amazon Elastic Compute Cloud User Guide for Windows Instances .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance-elasticgpuspecification.html#cfn-ec2-instance-elasticgpuspecification-type

Return type

str

ElasticInferenceAcceleratorProperty

class CfnInstance.ElasticInferenceAcceleratorProperty(*, type, count=None)

Bases: object

Specifies the Elastic Inference Accelerator for the instance.

ElasticInferenceAccelerator is a property of the AWS::EC2::Instance resource.

Parameters
  • type (str) – The type of elastic inference accelerator. The possible values are eia1.medium , eia1.large , eia1.xlarge , eia2.medium , eia2.large , and eia2.xlarge .

  • count (Union[int, float, None]) – The number of elastic inference accelerators to attach to the instance.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance-elasticinferenceaccelerator.html

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_ec2 as ec2

elastic_inference_accelerator_property = ec2.CfnInstance.ElasticInferenceAcceleratorProperty(
    type="type",

    # the properties below are optional
    count=123
)

Attributes

count

The number of elastic inference accelerators to attach to the instance.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance-elasticinferenceaccelerator.html#cfn-ec2-instance-elasticinferenceaccelerator-count

Return type

Union[int, float, None]

type

The type of elastic inference accelerator.

The possible values are eia1.medium , eia1.large , eia1.xlarge , eia2.medium , eia2.large , and eia2.xlarge .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance-elasticinferenceaccelerator.html#cfn-ec2-instance-elasticinferenceaccelerator-type

Return type

str

EnclaveOptionsProperty

class CfnInstance.EnclaveOptionsProperty(*, enabled=None)

Bases: object

Indicates whether the instance is enabled for AWS Nitro Enclaves.

Parameters

enabled (Union[bool, IResolvable, None]) – If this parameter is set to true , the instance is enabled for AWS Nitro Enclaves; otherwise, it is not enabled for AWS Nitro Enclaves.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance-enclaveoptions.html

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_ec2 as ec2

enclave_options_property = ec2.CfnInstance.EnclaveOptionsProperty(
    enabled=False
)

Attributes

enabled

If this parameter is set to true , the instance is enabled for AWS Nitro Enclaves;

otherwise, it is not enabled for AWS Nitro Enclaves.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance-enclaveoptions.html#cfn-ec2-instance-enclaveoptions-enabled

Return type

Union[bool, IResolvable, None]

HibernationOptionsProperty

class CfnInstance.HibernationOptionsProperty(*, configured=None)

Bases: object

Specifies the hibernation options for the instance.

HibernationOptions is a property of the AWS::EC2::Instance resource.

Parameters

configured (Union[bool, IResolvable, None]) – If you set this parameter to true , your instance is enabled for hibernation. Default: false

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance-hibernationoptions.html

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_ec2 as ec2

hibernation_options_property = ec2.CfnInstance.HibernationOptionsProperty(
    configured=False
)

Attributes

configured

If you set this parameter to true , your instance is enabled for hibernation.

Default: false

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance-hibernationoptions.html#cfn-ec2-instance-hibernationoptions-configured

Return type

Union[bool, IResolvable, None]

InstanceIpv6AddressProperty

class CfnInstance.InstanceIpv6AddressProperty(*, ipv6_address)

Bases: object

Specifies the IPv6 address for the instance.

InstanceIpv6Address is a property of the AWS::EC2::Instance resource.

Parameters

ipv6_address (str) – The IPv6 address.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance-instanceipv6address.html

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_ec2 as ec2

instance_ipv6_address_property = ec2.CfnInstance.InstanceIpv6AddressProperty(
    ipv6_address="ipv6Address"
)

Attributes

ipv6_address

The IPv6 address.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance-instanceipv6address.html#cfn-ec2-instance-instanceipv6address-ipv6address

Return type

str

LaunchTemplateSpecificationProperty

class CfnInstance.LaunchTemplateSpecificationProperty(*, version, launch_template_id=None, launch_template_name=None)

Bases: object

Specifies a launch template. You must specify either the launch template ID or launch template name.

LaunchTemplateSpecification is a property of the AWS::EC2::Instance resource.

Parameters
  • version (str) – The version number of the launch template. AWS CloudFormation does not support specifying $Latest , or $Default for the template version number.

  • launch_template_id (Optional[str]) – The ID of the launch template.

  • launch_template_name (Optional[str]) – The name of the launch template.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance-launchtemplatespecification.html

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_ec2 as ec2

launch_template_specification_property = ec2.CfnInstance.LaunchTemplateSpecificationProperty(
    version="version",

    # the properties below are optional
    launch_template_id="launchTemplateId",
    launch_template_name="launchTemplateName"
)

Attributes

launch_template_id

The ID of the launch template.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance-launchtemplatespecification.html#cfn-ec2-instance-launchtemplatespecification-launchtemplateid

Return type

Optional[str]

launch_template_name

The name of the launch template.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance-launchtemplatespecification.html#cfn-ec2-instance-launchtemplatespecification-launchtemplatename

Return type

Optional[str]

version

The version number of the launch template.

AWS CloudFormation does not support specifying $Latest , or $Default for the template version number.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance-launchtemplatespecification.html#cfn-ec2-instance-launchtemplatespecification-version

Return type

str

LicenseSpecificationProperty

class CfnInstance.LicenseSpecificationProperty(*, license_configuration_arn)

Bases: object

Specifies the license configuration to use.

LicenseSpecification is a property of the AWS::EC2::Instance resource.

Parameters

license_configuration_arn (str) – The Amazon Resource Name (ARN) of the license configuration.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance-licensespecification.html

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_ec2 as ec2

license_specification_property = ec2.CfnInstance.LicenseSpecificationProperty(
    license_configuration_arn="licenseConfigurationArn"
)

Attributes

license_configuration_arn

The Amazon Resource Name (ARN) of the license configuration.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance-licensespecification.html#cfn-ec2-instance-licensespecification-licenseconfigurationarn

Return type

str

NetworkInterfaceProperty

class CfnInstance.NetworkInterfaceProperty(*, device_index, associate_carrier_ip_address=None, associate_public_ip_address=None, delete_on_termination=None, description=None, group_set=None, ipv6_address_count=None, ipv6_addresses=None, network_interface_id=None, private_ip_address=None, private_ip_addresses=None, secondary_private_ip_address_count=None, subnet_id=None)

Bases: object

Specifies a network interface that is to be attached to an instance.

You can create a network interface when launching an instance. For an example, see the AWS::EC2::Instance examples .

Alternatively, you can attach an existing network interface when launching an instance. For an example, see the AWS::EC2:NetworkInterface examples .

Parameters
  • device_index (str) – The position of the network interface in the attachment order. A primary network interface has a device index of 0. If you create a network interface when launching an instance, you must specify the device index.

  • associate_carrier_ip_address (Union[bool, IResolvable, None]) – CfnInstance.NetworkInterfaceProperty.AssociateCarrierIpAddress.

  • associate_public_ip_address (Union[bool, IResolvable, None]) – Indicates whether to assign a public IPv4 address to an instance. Applies only if creating a network interface when launching an instance. The network interface must be the primary network interface. If launching into a default subnet, the default value is true .

  • delete_on_termination (Union[bool, IResolvable, None]) – Indicates whether the network interface is deleted when the instance is terminated. Applies only if creating a network interface when launching an instance.

  • description (Optional[str]) – The description of the network interface. Applies only if creating a network interface when launching an instance.

  • group_set (Optional[Sequence[str]]) – The IDs of the security groups for the network interface. Applies only if creating a network interface when launching an instance.

  • ipv6_address_count (Union[int, float, None]) – A number of IPv6 addresses to assign to the network interface. Amazon EC2 chooses the IPv6 addresses from the range of the 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.

  • ipv6_addresses (Union[IResolvable, Sequence[Union[IResolvable, InstanceIpv6AddressProperty, Dict[str, Any]]], None]) – One or more IPv6 addresses to assign to the 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.

  • network_interface_id (Optional[str]) – The ID of the network interface, when attaching an existing network interface.

  • private_ip_address (Optional[str]) – The private IPv4 address of the network interface. Applies only if creating a network interface when launching an instance.

  • private_ip_addresses (Union[IResolvable, Sequence[Union[IResolvable, PrivateIpAddressSpecificationProperty, Dict[str, Any]]], None]) – One or more private IPv4 addresses to assign to the network interface. Only one private IPv4 address can be designated as primary.

  • secondary_private_ip_address_count (Union[int, float, None]) – The number of secondary private IPv4 addresses. You can’t specify this option and specify more than one private IP address using the private IP addresses option.

  • subnet_id (Optional[str]) – The ID of the subnet associated with the network interface. Applies only if creating a network interface when launching an instance.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-network-iface-embedded.html

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_ec2 as ec2

network_interface_property = ec2.CfnInstance.NetworkInterfaceProperty(
    device_index="deviceIndex",

    # the properties below are optional
    associate_carrier_ip_address=False,
    associate_public_ip_address=False,
    delete_on_termination=False,
    description="description",
    group_set=["groupSet"],
    ipv6_address_count=123,
    ipv6_addresses=[ec2.CfnInstance.InstanceIpv6AddressProperty(
        ipv6_address="ipv6Address"
    )],
    network_interface_id="networkInterfaceId",
    private_ip_address="privateIpAddress",
    private_ip_addresses=[ec2.CfnInstance.PrivateIpAddressSpecificationProperty(
        primary=False,
        private_ip_address="privateIpAddress"
    )],
    secondary_private_ip_address_count=123,
    subnet_id="subnetId"
)

Attributes

associate_carrier_ip_address

CfnInstance.NetworkInterfaceProperty.AssociateCarrierIpAddress.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-network-iface-embedded.html#cfn-ec2-instance-networkinterface-associatecarrieripaddress

Return type

Union[bool, IResolvable, None]

associate_public_ip_address

Indicates whether to assign a public IPv4 address to an instance.

Applies only if creating a network interface when launching an instance. The network interface must be the primary network interface. If launching into a default subnet, the default value is true .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-network-iface-embedded.html#aws-properties-ec2-network-iface-embedded-associatepubip

Return type

Union[bool, IResolvable, None]

delete_on_termination

Indicates whether the network interface is deleted when the instance is terminated.

Applies only if creating a network interface when launching an instance.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-network-iface-embedded.html#aws-properties-ec2-network-iface-embedded-delete

Return type

Union[bool, IResolvable, None]

description

The description of the network interface.

Applies only if creating a network interface when launching an instance.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-network-iface-embedded.html#aws-properties-ec2-network-iface-embedded-description

Return type

Optional[str]

device_index

The position of the network interface in the attachment order.

A primary network interface has a device index of 0.

If you create a network interface when launching an instance, you must specify the device index.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-network-iface-embedded.html#aws-properties-ec2-network-iface-embedded-deviceindex

Return type

str

group_set

The IDs of the security groups for the network interface.

Applies only if creating a network interface when launching an instance.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-network-iface-embedded.html#aws-properties-ec2-network-iface-embedded-groupset

Return type

Optional[List[str]]

ipv6_address_count

A number of IPv6 addresses to assign to the network interface.

Amazon EC2 chooses the IPv6 addresses from the range of the 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.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-network-iface-embedded.html#cfn-ec2-instance-networkinterface-ipv6addresscount

Return type

Union[int, float, None]

ipv6_addresses

One or more IPv6 addresses to assign to the 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.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-network-iface-embedded.html#cfn-ec2-instance-networkinterface-ipv6addresses

Return type

Union[IResolvable, List[Union[IResolvable, InstanceIpv6AddressProperty]], None]

network_interface_id

The ID of the network interface, when attaching an existing network interface.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-network-iface-embedded.html#aws-properties-ec2-network-iface-embedded-network-iface

Return type

Optional[str]

private_ip_address

The private IPv4 address of the network interface.

Applies only if creating a network interface when launching an instance.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-network-iface-embedded.html#aws-properties-ec2-network-iface-embedded-privateipaddress

Return type

Optional[str]

private_ip_addresses

One or more private IPv4 addresses to assign to the network interface.

Only one private IPv4 address can be designated as primary.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-network-iface-embedded.html#aws-properties-ec2-network-iface-embedded-privateipaddresses

Return type

Union[IResolvable, List[Union[IResolvable, PrivateIpAddressSpecificationProperty]], None]

secondary_private_ip_address_count

The number of secondary private IPv4 addresses.

You can’t specify this option and specify more than one private IP address using the private IP addresses option.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-network-iface-embedded.html#aws-properties-ec2-network-iface-embedded-secondprivateip

Return type

Union[int, float, None]

subnet_id

The ID of the subnet associated with the network interface.

Applies only if creating a network interface when launching an instance.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-network-iface-embedded.html#aws-properties-ec2-network-iface-embedded-subnetid

Return type

Optional[str]

NoDeviceProperty

class CfnInstance.NoDeviceProperty

Bases: object

Suppresses the specified device included in the block device mapping of the AMI.

To suppress a device, specify an empty string.

NoDevice is a property of the Amazon EC2 BlockDeviceMapping property.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance-nodevice.html

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_ec2 as ec2

no_device_property = ec2.CfnInstance.NoDeviceProperty()

PrivateDnsNameOptionsProperty

class CfnInstance.PrivateDnsNameOptionsProperty(*, enable_resource_name_dns_aaaa_record=None, enable_resource_name_dns_a_record=None, hostname_type=None)

Bases: object

The type of hostnames to assign to instances in the subnet at launch.

For IPv4 only subnets, an instance DNS name must be based on the instance IPv4 address. For IPv6 only subnets, an instance DNS name must be based on the instance ID. For dual-stack subnets, you can specify whether DNS names use the instance IPv4 address or the instance ID. For more information, see Amazon EC2 instance hostname types in the Amazon Elastic Compute Cloud User Guide .

Parameters
  • enable_resource_name_dns_aaaa_record (Union[bool, IResolvable, None]) –

    Indicates whether to respond to DNS queries for instance hostnames with DNS AAAA records. For more information, see Amazon EC2 instance hostname types in the Amazon Elastic Compute Cloud User Guide .

  • enable_resource_name_dns_a_record (Union[bool, IResolvable, None]) –

    Indicates whether to respond to DNS queries for instance hostnames with DNS A records. For more information, see Amazon EC2 instance hostname types in the Amazon Elastic Compute Cloud User Guide .

  • hostname_type (Optional[str]) –

    The type of hostnames to assign to instances in the subnet at launch. For IPv4 only subnets, an instance DNS name must be based on the instance IPv4 address. For IPv6 only subnets, an instance DNS name must be based on the instance ID. For dual-stack subnets, you can specify whether DNS names use the instance IPv4 address or the instance ID. For more information, see Amazon EC2 instance hostname types in the Amazon Elastic Compute Cloud User Guide .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance-privatednsnameoptions.html

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_ec2 as ec2

private_dns_name_options_property = ec2.CfnInstance.PrivateDnsNameOptionsProperty(
    enable_resource_name_dns_aaaa_record=False,
    enable_resource_name_dns_aRecord=False,
    hostname_type="hostnameType"
)

Attributes

enable_resource_name_dns_a_record

Indicates whether to respond to DNS queries for instance hostnames with DNS A records.

For more information, see Amazon EC2 instance hostname types in the Amazon Elastic Compute Cloud User Guide .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance-privatednsnameoptions.html#cfn-ec2-instance-privatednsnameoptions-enableresourcenamednsarecord

Return type

Union[bool, IResolvable, None]

enable_resource_name_dns_aaaa_record

Indicates whether to respond to DNS queries for instance hostnames with DNS AAAA records.

For more information, see Amazon EC2 instance hostname types in the Amazon Elastic Compute Cloud User Guide .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance-privatednsnameoptions.html#cfn-ec2-instance-privatednsnameoptions-enableresourcenamednsaaaarecord

Return type

Union[bool, IResolvable, None]

hostname_type

The type of hostnames to assign to instances in the subnet at launch.

For IPv4 only subnets, an instance DNS name must be based on the instance IPv4 address. For IPv6 only subnets, an instance DNS name must be based on the instance ID. For dual-stack subnets, you can specify whether DNS names use the instance IPv4 address or the instance ID. For more information, see Amazon EC2 instance hostname types in the Amazon Elastic Compute Cloud User Guide .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance-privatednsnameoptions.html#cfn-ec2-instance-privatednsnameoptions-hostnametype

Return type

Optional[str]

PrivateIpAddressSpecificationProperty

class CfnInstance.PrivateIpAddressSpecificationProperty(*, primary, private_ip_address)

Bases: object

Specifies a secondary private IPv4 address for a network interface.

PrivateIpAddressSpecification is a property of the AWS::EC2::NetworkInterface resource.

Parameters
  • primary (Union[bool, IResolvable]) – Indicates whether the private IPv4 address is the primary private IPv4 address. Only one IPv4 address can be designated as primary.

  • private_ip_address (str) – The private IPv4 addresses.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-network-interface-privateipspec.html

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_ec2 as ec2

private_ip_address_specification_property = ec2.CfnInstance.PrivateIpAddressSpecificationProperty(
    primary=False,
    private_ip_address="privateIpAddress"
)

Attributes

primary

Indicates whether the private IPv4 address is the primary private IPv4 address.

Only one IPv4 address can be designated as primary.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-network-interface-privateipspec.html#cfn-ec2-networkinterface-privateipspecification-primary

Return type

Union[bool, IResolvable]

private_ip_address

The private IPv4 addresses.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-network-interface-privateipspec.html#cfn-ec2-networkinterface-privateipspecification-privateipaddress

Return type

str

SsmAssociationProperty

class CfnInstance.SsmAssociationProperty(*, document_name, association_parameters=None)

Bases: object

Specifies the SSM document and parameter values in AWS Systems Manager to associate with an instance.

SsmAssociations is a property of the AWS::EC2::Instance resource.

Parameters
  • document_name (str) – The name of an SSM document to associate with the instance.

  • association_parameters (Union[IResolvable, Sequence[Union[IResolvable, AssociationParameterProperty, Dict[str, Any]]], None]) – The input parameter values to use with the associated SSM document.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance-ssmassociations.html

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_ec2 as ec2

ssm_association_property = ec2.CfnInstance.SsmAssociationProperty(
    document_name="documentName",

    # the properties below are optional
    association_parameters=[ec2.CfnInstance.AssociationParameterProperty(
        key="key",
        value=["value"]
    )]
)

Attributes

association_parameters

The input parameter values to use with the associated SSM document.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance-ssmassociations.html#cfn-ec2-instance-ssmassociations-associationparameters

Return type

Union[IResolvable, List[Union[IResolvable, AssociationParameterProperty]], None]

document_name

The name of an SSM document to associate with the instance.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance-ssmassociations.html#cfn-ec2-instance-ssmassociations-documentname

Return type

str

VolumeProperty

class CfnInstance.VolumeProperty(*, device, volume_id)

Bases: object

Specifies a volume to attach to an instance.

Volume is an embedded property of the AWS::EC2::Instance resource.

Parameters
  • device (str) – The device name (for example, /dev/sdh or xvdh ).

  • volume_id (str) – The ID of the EBS volume. The volume and instance must be within the same Availability Zone.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-mount-point.html

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_ec2 as ec2

volume_property = ec2.CfnInstance.VolumeProperty(
    device="device",
    volume_id="volumeId"
)

Attributes

device

The device name (for example, /dev/sdh or xvdh ).

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-mount-point.html#cfn-ec2-mountpoint-device

Return type

str

volume_id

The ID of the EBS volume.

The volume and instance must be within the same Availability Zone.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-mount-point.html#cfn-ec2-mountpoint-volumeid

Return type

str