---
type: resource-type
title: Instance
description: aws resource type AWS::EC2::Instance
name: Instance
lexicon: aws
resource_type: AWS::EC2::Instance
---
`AWS::EC2::Instance`, a resource type of the aws lexicon.

## Properties

- `AdditionalInfo` (`string`, optional): 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` (`"default" | "host"`, optional): 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.
- `AvailabilityZone` (`string`, optional): The Availability Zone of the instance.
- `BlockDeviceMappings` (`Instance_BlockDeviceMapping[]`, optional): The block device mapping entries that defines the block devices to attach to the instance at launch.
- `CpuOptions` (`Record<string, unknown>`, optional): The CPU options for the instance.
- `CreditSpecification` (`Record<string, unknown>`, optional): The credit option for CPU usage of the burstable performance instance. Valid values are standard and unlimited.
- `DisableApiTermination` (`boolean`, optional): If you set this parameter to true, you can't terminate the instance using the Amazon EC2 console, CLI, or API; otherwise, you can.
- `EbsOptimized` (`boolean`, optional): Indicates whether the instance is optimized for Amazon EBS I/O.
- `ElasticGpuSpecifications` (`Instance_ElasticGpuSpecification[]`, optional): An elastic GPU to associate with the instance. Amazon Elastic Graphics is no longer available.
- `ElasticInferenceAccelerators` (`Instance_ElasticInferenceAccelerator[]`, optional): An elastic inference accelerator to associate with the instance. Amazon Elastic Inference is no longer available.
- `EnclaveOptions` (`Record<string, unknown>`, optional): Indicates whether the instance is enabled for AWS Nitro Enclaves.
- `HibernationOptions` (`Record<string, unknown>`, optional): Indicates whether an instance is enabled for hibernation.
- `HostId` (`string`, optional): 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.
- `HostResourceGroupArn` (`string`, optional): 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.
- `IamInstanceProfile` (`string`, optional): The IAM instance profile.
- `ImageId` (`string`, optional): The ID of the AMI. An AMI ID is required to launch an instance and must be specified here or in a launch template.
- `InstanceId` (`string`, optional): The EC2 Instance ID.
- `InstanceInitiatedShutdownBehavior` (`string`, optional): Indicates whether an instance stops or terminates when you initiate shutdown from the instance (using the operating system command for system shutdown).
- `InstanceType` (`string`, optional): The instance type.
- `Ipv6AddressCount` (`number`, optional): [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.
- `Ipv6Addresses` (`Instance_InstanceIpv6Address[]`, optional): [EC2-VPC] The IPv6 addresses from the range of the subnet to associate with the primary network interface.
- `KernelId` (`string`, optional): The ID of the kernel.
- `KeyName` (`string`, optional): The name of the key pair.
- `LaunchTemplate` (`Instance_LaunchTemplateSpecification`, optional): The launch template to use to launch the instances.
- `LicenseSpecifications` (`Instance_LicenseSpecification[]`, optional): The license configurations.
- `MetadataOptions` (`Instance_MetadataOptions`, optional): The metadata options for the instance
- `Monitoring` (`boolean`, optional): Specifies whether detailed monitoring is enabled for the instance.
- `NetworkInterfaces` (`Instance_NetworkInterface[]`, optional): The network interfaces to associate with the instance.
- `PlacementGroupName` (`string`, optional): The name of an existing placement group that you want to launch the instance into (cluster | partition | spread).
- `PrivateDnsName` (`string`, optional): The private DNS name of the specified instance. For example: ip-10-24-34-0.ec2.internal.
- `PrivateDnsNameOptions` (`Instance_PrivateDnsNameOptions`, optional): The options for the instance hostname.
- `PrivateIp` (`string`, optional): The private IP address of the specified instance. For example: 10.24.34.0.
- `PrivateIpAddress` (`string`, optional): [EC2-VPC] The primary IPv4 address. You must specify a value from the IPv4 address range of the subnet.
- `PropagateTagsToVolumeOnCreation` (`boolean`, optional): 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.
- `PublicDnsName` (`string`, optional): The public DNS name of the specified instance. For example: ec2-107-20-50-45.compute-1.amazonaws.com.
- `PublicIp` (`string`, optional): The public IP address of the specified instance. For example: 192.0.2.0.
- `RamdiskId` (`string`, optional): The ID of the RAM disk to select.
- `SecurityGroupIds` (`string[]`, optional): The IDs of the security groups.
- `SecurityGroups` (`string[]`, optional): the names of the security groups. For a nondefault VPC, you must use security group IDs instead.
- `SourceDestCheck` (`boolean`, optional): Specifies whether to enable an instance launched in a VPC to perform NAT.
- `SsmAssociations` (`Instance_SsmAssociation[]`, optional): The SSM document and parameter values in AWS Systems Manager to associate with this instance.
- `State` (`Instance_State`, optional): The current state of the instance.
- `SubnetId` (`string`, optional): [EC2-VPC] The ID of the subnet to launch the instance into.
- `Tags` (`Instance_Tag[]`, optional): The tags to add to the instance.
- `Tenancy` (`string`, optional): 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.
- `UserData` (`string`, optional): The user data to make available to the instance.
- `Volumes` (`Instance_Volume[]`, optional): The volumes to attach to the instance.
- `VpcId` (`string`, optional): The ID of the VPC that the instance is running in.

## Attributes

- `InstanceId`
- `PrivateDnsName`
- `PrivateIp`
- `PublicDnsName`
- `PublicIp`
- `State`
- `VpcId`
