CfnInstanceProps

class aws_cdk.aws_ec2.CfnInstanceProps(*, 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: object

Properties for defining a CfnInstance.

Parameters
  • 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[BlockDeviceMappingProperty, Dict[str, Any], IResolvable]], 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[CpuOptionsProperty, Dict[str, Any], IResolvable, 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[CreditSpecificationProperty, Dict[str, Any], IResolvable, 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[ElasticGpuSpecificationProperty, Dict[str, Any], IResolvable]], 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[ElasticInferenceAcceleratorProperty, Dict[str, Any], IResolvable]], 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[EnclaveOptionsProperty, Dict[str, Any], IResolvable, None]) – Indicates whether the instance is enabled for AWS Nitro Enclaves.

  • hibernation_options (Union[HibernationOptionsProperty, Dict[str, Any], IResolvable, 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[InstanceIpv6AddressProperty, Dict[str, Any], IResolvable]], 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[LaunchTemplateSpecificationProperty, Dict[str, Any], IResolvable, 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[LicenseSpecificationProperty, Dict[str, Any], IResolvable]], 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[NetworkInterfaceProperty, Dict[str, Any], IResolvable]], 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[PrivateDnsNameOptionsProperty, Dict[str, Any], IResolvable, 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[SsmAssociationProperty, Dict[str, Any], IResolvable]], 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[VolumeProperty, Dict[str, Any], IResolvable]], None]) – The volumes to attach to the 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.
from aws_cdk import aws_ec2 as ec2

cfn_instance_props = ec2.CfnInstanceProps(
    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"
    )]
)

Attributes

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]

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[BlockDeviceMappingProperty, IResolvable]], None]

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[CpuOptionsProperty, IResolvable, None]

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[CreditSpecificationProperty, IResolvable, 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[ElasticGpuSpecificationProperty, IResolvable]], 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[ElasticInferenceAcceleratorProperty, IResolvable]], 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[EnclaveOptionsProperty, IResolvable, 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[HibernationOptionsProperty, IResolvable, 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[InstanceIpv6AddressProperty, IResolvable]], 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[LaunchTemplateSpecificationProperty, IResolvable, 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[LicenseSpecificationProperty, IResolvable]], None]

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[NetworkInterfaceProperty, IResolvable]], None]

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[PrivateDnsNameOptionsProperty, IResolvable, 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]

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[SsmAssociationProperty, IResolvable]], None]

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

Optional[List[CfnTag]]

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[VolumeProperty, IResolvable]], None]