AWS::EC2::InstanceResource Type definition for AWS::EC2::Instance
41 configurable properties. Click a row to see details.
| Property | Type | Flags |
|---|---|---|
AdditionalInfo | string | Write-only |
Affinity | string | |
AvailabilityZone | string | Create-only |
BlockDeviceMappings | Array<BlockDeviceMapping> | |
CpuOptions | object | Create-only |
CreditSpecification | object | |
DisableApiTermination | boolean | |
EbsOptimized | boolean | |
ElasticGpuSpecifications | Array<ElasticGpuSpecification> | Create-only |
ElasticInferenceAccelerators | Array<ElasticInferenceAccelerator> | Create-only |
EnclaveOptions | object | Create-only |
HibernationOptions | object | Create-only |
HostId | string | |
HostResourceGroupArn | string | Create-only |
IamInstanceProfile | string | |
ImageId | string | Create-only |
InstanceInitiatedShutdownBehavior | string | |
InstanceType | string | |
Ipv6AddressCount | integer | Create-onlyWrite-only |
Ipv6Addresses | Array<InstanceIpv6Address> | Create-onlyWrite-only |
KernelId | string | |
KeyName | string | Create-only |
LaunchTemplate | LaunchTemplateSpecification | Create-onlyWrite-only |
LicenseSpecifications | Array<LicenseSpecification> | Create-only |
MetadataOptions | MetadataOptions | |
Monitoring | boolean | |
NetworkInterfaces | Array<NetworkInterface> | Create-only |
PlacementGroupName | string | Create-only |
PrivateDnsNameOptions | PrivateDnsNameOptions | |
PrivateIpAddress | string | Create-only |
PropagateTagsToVolumeOnCreation | boolean | Write-only |
RamdiskId | string | |
SecurityGroupIds | Array<string> | |
SecurityGroups | Array<string> | Create-only |
SourceDestCheck | boolean | |
SsmAssociations | Array<SsmAssociation> | |
SubnetId | string | Create-only |
Tags | Array<Tag> | |
Tenancy | string | |
UserData | string | |
Volumes | Array<Volume> |
Values returned after the resource is created. Access these with Fn::GetAtt.
| Attribute | Type | Description |
|---|---|---|
InstanceId | string | The EC2 Instance ID. |
PrivateDnsName | string | The private DNS name of the specified instance. For example: ip-10-24-34-0.ec2.internal. |
PrivateIp | string | The private IP address of the specified instance. For example: 10.24.34.0. |
PublicDnsName | string | The public DNS name of the specified instance. For example: ec2-107-20-50-45.compute-1.amazonaws.com. |
PublicIp | string | The public IP address of the specified instance. For example: 192.0.2.0. |
State | State | The current state of the instance. |
VpcId | string | The ID of the VPC that the instance is running in. |
A minimal template with required properties and common optional ones.
AWSTemplateFormatVersion: "2010-09-09"
Description: Sample template for AWS::EC2::Instance
Resources:
MyResource:
Type: AWS::EC2::Instance
Properties:
Tags:
- Key: Environment
Value: ProductionPermissions CloudFormation needs in your IAM role to manage this resource.
ec2:DescribeNetworkInterfacesec2:DescribeVolumesec2:DescribeInstancesec2:DescribeInstanceAttributeec2:DescribeInstanceCreditSpecificationsec2:DescribeLaunchTemplatesssm:DescribeAssociationssm:ListAssociationsiam:PassRoleec2:ModifyPrivateDnsNameOptionsec2:DescribeNetworkInterfacesec2:DescribeVolumesec2:RunInstancesec2:AssociateIamInstanceProfileec2:DescribeIamInstanceProfileAssociationsec2:DescribeInstancesec2:ModifyPrivateDnsNameOptionsec2:DescribeNetworkInterfacesec2:AssociateIamInstanceProfileec2:DescribeIamInstanceProfileAssociationsec2:DescribeInstancesec2:DescribeSubnetsec2:DescribeKeyPairsec2:DescribeSecurityGroupsec2:DescribeInstancesec2:DescribeInstancesec2:TerminateInstancesec2:DescribeNetworkInterfacesec2:DescribeVolumesec2:DescribeInstancesec2:DescribeInstanceAttributeec2:DescribeInstanceCreditSpecificationsec2:DescribeLaunchTemplatesEverything you need to know about EC2 on one page. HD quality, print-friendly.
Download Free InfographicInstanceIdThese properties cannot be changed after the resource is created. Updating them triggers a replacement.
AvailabilityZoneCpuOptionsElasticGpuSpecificationsElasticInferenceAcceleratorsEnclaveOptionsHibernationOptionsHostResourceGroupArnImageIdIpv6AddressCountIpv6AddressesKeyNameLaunchTemplateLicenseSpecificationsNetworkInterfacesPlacementGroupNamePrivateIpAddressSecurityGroupsSubnetId