AWS Identity and Access Management
User Guide

The AWS Documentation website is getting a new look!
Try it now and let us know what you think. Switch to the new look >>

You can return to the original look by selecting English in the language selector above.

Actions, Resources, and Condition Keys for Amazon EC2

Amazon EC2 (service prefix: ec2) provides the following service-specific resources, actions, and condition context keys for use in IAM permission policies.

References:

Actions Defined by Amazon EC2

Amazon EC2 has no API operations that can be used in the Actions element of an IAM policy statement. To allow access to Amazon EC2, specify “Action”: “ec2:*” in your policy.

Resources Defined by Amazon EC2

The following resource types are defined by this service and can be used in the Resource element of IAM permission policy statements. Each action in the Actions table identifies the resource types that can be specified with that action. A resource type can also define which condition keys you can include in a policy. These keys are displayed in the last column of the table. For details about the columns in the following table, see The Resource Types Table.

Resource Types ARN Condition Keys
capacity-reservation arn:${Partition}:ec2:${Region}:${Account}:capacity-reservation/${CapacityReservationId}

aws:RequestTag/${TagKey}

aws:TagKeys

ec2:Region

ec2:ResourceTag/${TagKey}

client-vpn-endpoint arn:${Partition}:ec2:${Region}:${Account}:client-vpn-endpoint/${ClientVpnEndpointId}

aws:RequestTag/${TagKey}

aws:TagKeys

ec2:Region

ec2:ResourceTag/${TagKey}

customer-gateway arn:${Partition}:ec2:${Region}:${Account}:customer-gateway/${CustomerGatewayId}

ec2:Region

ec2:ResourceTag/${TagKey}

dhcp-options arn:${Partition}:ec2:${Region}:${Account}:dhcp-options/${DhcpOptionsId}

aws:RequestTag/${TagKey}

aws:TagKeys

ec2:Region

ec2:ResourceTag/${TagKey}

elastic-gpu arn:${Partition}:ec2:${Region}:${Account}:elasticGpu/${ElasticGpuId}
fpga-image arn:${Partition}:ec2:${Region}::fpga-image/${FpgaImageId}

aws:RequestTag/${TagKey}

aws:TagKeys

ec2:Owner

ec2:Public

ec2:Region

ec2:ResourceTag/${TagKey}

image arn:${Partition}:ec2:${Region}::image/${ImageId}

aws:RequestTag/${TagKey}

aws:TagKeys

ec2:ImageType

ec2:Owner

ec2:Public

ec2:Region

ec2:ResourceTag/${TagKey}

ec2:RootDeviceType

instance arn:${Partition}:ec2:${Region}:${Account}:instance/${InstanceId}

aws:RequestTag/${TagKey}

aws:TagKeys

ec2:AvailabilityZone

ec2:EbsOptimized

ec2:InstanceProfile

ec2:InstanceType

ec2:PlacementGroup

ec2:Region

ec2:ResourceTag/${TagKey}

ec2:RootDeviceType

ec2:Tenancy

internet-gateway arn:${Partition}:ec2:${Region}:${Account}:internet-gateway/${InternetGatewayId}

aws:RequestTag/${TagKey}

aws:TagKeys

ec2:Region

ec2:ResourceTag/${TagKey}

key-pair arn:${Partition}:ec2:${Region}:${Account}:key-pair/${KeyPairName}

ec2:Region

launch-template arn:${Partition}:ec2:${Region}:${Account}:launch-template/${LaunchTemplateId}

ec2:Region

ec2:ResourceTag/${TagKey}

network-acl arn:${Partition}:ec2:${Region}:${Account}:network-acl/${NaclId}

aws:RequestTag/${TagKey}

aws:TagKeys

ec2:Region

ec2:ResourceTag/${TagKey}

ec2:Vpc

network-interface arn:${Partition}:ec2:${Region}:${Account}:network-interface/${NetworkInterfaceId}

aws:RequestTag/${TagKey}

aws:TagKeys

ec2:AuthorizedService

ec2:AvailabilityZone

ec2:Region

ec2:ResourceTag/${TagKey}

ec2:Subnet

ec2:Vpc

placement-group arn:${Partition}:ec2:${Region}:${Account}:placement-group/${PlacementGroupName}

ec2:PlacementGroupStrategy

ec2:Region

reserved-instances arn:${Partition}:ec2:${Region}:${Account}:reserved-instances/${ReservationId}

aws:RequestTag/${TagKey}

aws:TagKeys

ec2:AvailabilityZone

ec2:InstanceType

ec2:Region

ec2:ReservedInstancesOfferingType

ec2:ResourceTag/${TagKey}

ec2:Tenancy

route-table arn:${Partition}:ec2:${Region}:${Account}:route-table/${RouteTableId}

aws:RequestTag/${TagKey}

aws:TagKeys

ec2:Region

ec2:ResourceTag/${TagKey}

ec2:Vpc

security-group arn:${Partition}:ec2:${Region}:${Account}:security-group/${SecurityGroupId}

aws:RequestTag/${TagKey}

aws:TagKeys

ec2:Region

ec2:ResourceTag/${TagKey}

ec2:Vpc

snapshot arn:${Partition}:ec2:${Region}::snapshot/${SnapshotId}

aws:RequestTag/${TagKey}

aws:TagKeys

ec2:Owner

ec2:ParentVolume

ec2:Region

ec2:ResourceTag/${TagKey}

ec2:SnapshotTime

ec2:VolumeSize

spot-instance-request arn:${Partition}:ec2:${Region}::spot-instance-request/${SpotInstanceRequestId}

aws:RequestTag/${TagKey}

aws:TagKeys

ec2:Region

ec2:ResourceTag/${TagKey}

subnet arn:${Partition}:ec2:${Region}:${Account}:subnet/${SubnetId}

aws:RequestTag/${TagKey}

aws:TagKeys

ec2:AvailabilityZone

ec2:Region

ec2:ResourceTag/${TagKey}

ec2:Vpc

transit-gateway-attachment arn:${Partition}:ec2:${Region}:${Account}:transit-gateway-attachment/${TransitGatewayAttachmentId}

aws:RequestTag/${TagKey}

aws:TagKeys

ec2:Region

ec2:ResourceTag/${TagKey}

transit-gateway-route-table arn:${Partition}:ec2:${Region}:${Account}:transit-gateway-route-table/${TransitGatewayRouteTableId}

aws:RequestTag/${TagKey}

aws:TagKeys

ec2:Region

ec2:ResourceTag/${TagKey}

transit-gateway arn:${Partition}:ec2:${Region}:${Account}:transit-gateway/${TransitGatewayId}

aws:RequestTag/${TagKey}

aws:TagKeys

ec2:Region

ec2:ResourceTag/${TagKey}

volume arn:${Partition}:ec2:${Region}:${Account}:volume/${VolumeId}

aws:RequestTag/${TagKey}

aws:TagKeys

ec2:AvailabilityZone

ec2:Encrypted

ec2:ParentSnapshot

ec2:Region

ec2:ResourceTag/${TagKey}

ec2:VolumeIops

ec2:VolumeSize

ec2:VolumeType

vpc arn:${Partition}:ec2:${Region}:${Account}:vpc/${VpcId}

aws:RequestTag/${TagKey}

aws:TagKeys

ec2:Region

ec2:ResourceTag/${TagKey}

ec2:Tenancy

vpc-peering-connection arn:${Partition}:ec2:${Region}:${Account}:vpc-peering-connection/${VpcPeeringConnectionId}

ec2:AccepterVpc

ec2:Region

ec2:RequesterVpc

ec2:ResourceTag/${TagKey}

vpn-connection arn:${Partition}:ec2:${Region}:${Account}:vpn-connection/${VpnConnectionId}

aws:RequestTag/${TagKey}

aws:TagKeys

ec2:Region

ec2:ResourceTag/${TagKey}

vpn-gateway arn:${Partition}:ec2:${Region}:${Account}:vpn-gateway/${VpnGatewayId}

Condition Keys for Amazon EC2

Amazon EC2 defines the following condition keys that can be used in the Condition element of an IAM policy. You can use these keys to further refine the conditions under which the policy statement applies. For details about the columns in the following table, see The Condition Keys Table.

To view the global condition keys that are available to all services, see Available Global Condition Keys in the IAM Policy Reference.

Condition Keys Description Type
aws:RequestTag/${TagKey} A key that is present in the request the user makes to the EC2 service. String
aws:TagKeys The list of all the tag key names associated with the resource in the request. String
ec2:AccepterVpc The ARN of an accepter VPC in a VPC peering connection. ARN
ec2:AuthorizedService The AWS service that has permission to use a resource. String
ec2:AuthorizedUser The IAM principal that has permission to use a resource. String
ec2:AvailabilityZone The name of an Availability Zone in a region. String
ec2:CreateAction The name of a resource-creating API action. String
ec2:EbsOptimized Whether the instance is enabled for EBS-optimization. String
ec2:ElasticGpuType The name of the type of ElasticGpu. String
ec2:Encrypted Whether the volume is encrypted. String
ec2:ImageType The name of the type of image. String
ec2:InstanceMarketType The name of the market type. String
ec2:InstanceProfile The ARN of the instance profile. ARN
ec2:InstanceType The name of the instance type. String
ec2:IsLaunchTemplateResource Launch template resource flag. String
ec2:LaunchTemplate The ARN of the launch template. ARN
ec2:Owner The name or account ID of the owner. String
ec2:ParentSnapshot The ARN of the parent snapshot. ARN
ec2:ParentVolume The ARN of the parent volume. ARN
ec2:Permission The type of permission for a resource. String
ec2:PlacementGroup The ARN of the placement group. ARN
ec2:PlacementGroupStrategy The name of the placement group strategy. String
ec2:ProductCode The product code of the product. String
ec2:Public Whether the image is public. String
ec2:Region The name of the region. String
ec2:RequesterVpc The ARN of a requester VPC in a VPC peering connection. ARN
ec2:ReservedInstancesOfferingType The payment option for a Reserved Instance. String
ec2:ResourceTag/ The preface string for a tag key and value pair attached to a resource. String
ec2:ResourceTag/${TagKey} A tag key and value pair. String
ec2:RootDeviceType The root device type: ebs or instance-store. String
ec2:SnapshotTime The snapshot creation time. String
ec2:SourceInstanceARN The ARN of the instance from which the request originated. ARN
ec2:Subnet The ARN of the subnet. ARN
ec2:Tenancy The tenancy of the instance or VPC. String
ec2:VolumeIops The number of input/output operations per second. Numeric
ec2:VolumeSize The size of the volume, in GiB. Numeric
ec2:VolumeType The name of the type of volume. String
ec2:Vpc The ARN of the VPC. ARN