Skip to main content

instance

Gets or updates an individual instance resource, use instances to retrieve a list of resources or to create or delete a resource.

Overview

Nameinstance
TypeResource
DescriptionResource Type definition for AWS::EC2::Instance
Idaws.ec2.instance

Fields

NameDatatypeDescription
tenancystringThe tenancy of the instance (if the instance is running in a VPC). An instance with a tenancy of dedicated runs on single-tenant hardware.
security_groupsarraythe names of the security groups. For a nondefault VPC, you must use security group IDs instead.
private_dns_namestringThe private DNS name of the specified instance. For example: ip-10-24-34-0.ec2.internal.
private_ip_addressstring[EC2-VPC] The primary IPv4 address. You must specify a value from the IPv4 address range of the subnet.
user_datastringThe user data to make available to the instance.
block_device_mappingsarrayThe block device mapping entries that defines the block devices to attach to the instance at launch.
iam_instance_profilestringThe IAM instance profile.
ipv6_addressesarray[EC2-VPC] The IPv6 addresses from the range of the subnet to associate with the primary network interface.
kernel_idstringThe ID of the kernel.
subnet_idstring[EC2-VPC] The ID of the subnet to launch the instance into.<br/><br/>
ebs_optimizedbooleanIndicates whether the instance is optimized for Amazon EBS I/O.
propagate_tags_to_volume_on_creationbooleanIndicates 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.
elastic_gpu_specificationsarrayAn elastic GPU to associate with the instance.
elastic_inference_acceleratorsarrayAn elastic inference accelerator to associate with the instance.
volumesarrayThe volumes to attach to the instance.
private_ipstringThe private IP address of the specified instance. For example: 10.24.34.0.
ipv6_address_countinteger[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.
launch_templateobjectThe launch template to use to launch the instances.
enclave_optionsobjectIndicates whether the instance is enabled for AWS Nitro Enclaves.
network_interfacesarrayThe network interfaces to associate with the instance.
image_idstringThe ID of the AMI. An AMI ID is required to launch an instance and must be specified here or in a launch template.
instance_typestringThe instance type.
monitoringbooleanSpecifies whether detailed monitoring is enabled for the instance.
tagsarrayThe tags to add to the instance.
additional_infostringThis 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).
hibernation_optionsobjectIndicates whether an instance is enabled for hibernation.
license_specificationsarrayThe license configurations.
instance_idstringThe EC2 Instance ID.
public_ipstringThe public IP address of the specified instance. For example: 192.0.2.0.
instance_initiated_shutdown_behaviorstringIndicates whether an instance stops or terminates when you initiate shutdown from the instance (using the operating system command for system shutdown).
cpu_optionsobjectThe CPU options for the instance.
availability_zonestringThe Availability Zone of the instance.
private_dns_name_optionsobjectThe options for the instance hostname.
host_idstringIf 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.
host_resource_group_arnstringThe 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.
public_dns_namestringThe public DNS name of the specified instance. For example: ec2-107-20-50-45.compute-1.amazonaws.com.
security_group_idsarrayThe IDs of the security groups.
disable_api_terminationbooleanIf you set this parameter to true, you can't terminate the instance using the Amazon EC2 console, CLI, or API; otherwise, you can.
key_namestringThe name of the key pair.
ramdisk_idstringThe ID of the RAM disk to select.
source_dest_checkbooleanSpecifies whether to enable an instance launched in a VPC to perform NAT.
placement_group_namestringThe name of an existing placement group that you want to launch the instance into (cluster | partition | spread).
ssm_associationsarrayThe SSM document and parameter values in AWS Systems Manager to associate with this instance.
vpc_idstringThe ID of the VPC that the instance is running in.
affinitystringIndicates 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.
credit_specificationobjectThe credit option for CPU usage of the burstable performance instance. Valid values are standard and unlimited.
regionstringAWS region.

Methods

NameAccessible byRequired Params
update_resourceUPDATEdata__Identifier, data__PatchDocument, region
get_resourceSELECTdata__Identifier, region

SELECT Example

SELECT
region,
tenancy,
security_groups,
private_dns_name,
private_ip_address,
user_data,
block_device_mappings,
iam_instance_profile,
ipv6_addresses,
kernel_id,
subnet_id,
ebs_optimized,
propagate_tags_to_volume_on_creation,
elastic_gpu_specifications,
elastic_inference_accelerators,
volumes,
private_ip,
ipv6_address_count,
launch_template,
enclave_options,
network_interfaces,
image_id,
instance_type,
monitoring,
tags,
additional_info,
hibernation_options,
license_specifications,
instance_id,
public_ip,
instance_initiated_shutdown_behavior,
cpu_options,
availability_zone,
private_dns_name_options,
host_id,
host_resource_group_arn,
public_dns_name,
security_group_ids,
disable_api_termination,
key_name,
ramdisk_id,
source_dest_check,
placement_group_name,
ssm_associations,
vpc_id,
affinity,
credit_specification
FROM aws.ec2.instance
WHERE region = 'us-east-1' AND data__Identifier = '<InstanceId>';

Permissions

To operate on the instance resource, the following permissions are required:

Read

ec2:DescribeElasticGpus,
ec2:DescribeNetworkInterfaces,
ec2:DescribeVolumes,
ec2:DescribeInstances,
ec2:DescribeInstanceAttribute,
ec2:DescribeInstanceCreditSpecifications,
ec2:DescribeLaunchTemplates,
elastic-inference:DescribeAccelerators,
ssm:DescribeAssociation,
ssm:ListAssociations

Update

ec2:DescribeElasticGpus,
ec2:ModifyPrivateDnsNameOptions,
ec2:DescribeNetworkInterfaces,
ec2:AssociateIamInstanceProfile,
ec2:DescribeIamInstanceProfileAssociations,
ec2:DescribeInstances,
ec2:DescribeSubnets,
ec2:DescribeKeyPairs,
ec2:DescribeSecurityGroups,
ec2:DescribeVpcs,
ec2:DescribeInstanceAttribute,
ec2:DescribeInstanceCreditSpecifications,
ec2:DescribeLaunchTemplates,
ec2:DetachVolume,
ec2:DisassociateIamInstanceProfile,
ec2:ModifyInstanceAttribute,
ec2:ModifyInstanceCreditSpecification,
ec2:ModifyInstanceMaintenanceOptions,
ec2:ModifyInstancePlacement,
ec2:MonitorInstances,
ec2:AttachVolume,
ec2:CreateTags,
ec2:DeleteTags,
ec2:ReplaceIamInstanceProfileAssociation,
ec2:StartInstances,
ec2:StopInstances,
ec2:UnmonitorInstances,
elastic-inference:DescribeAccelerators,
ssm:CreateAssociation,
ssm:DeleteAssociation,
ssm:DescribeAssociation,
ssm:ListAssociations