Actions, resources, and condition keys for Amazon EC2 Instance Connect - Service Authorization Reference

Actions, resources, and condition keys for Amazon EC2 Instance Connect

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

References:

Actions defined by Amazon EC2 Instance Connect

You can specify the following actions in the Action element of an IAM policy statement. Use policies to grant permissions to perform an operation in AWS. When you use an action in a policy, you usually allow or deny access to the API operation or CLI command with the same name. However, in some cases, a single action controls access to more than one operation. Alternatively, some operations require several different actions.

The Resource types column of the Actions table indicates whether each action supports resource-level permissions. If there is no value for this column, you must specify all resources ("*") to which the policy applies in the Resource element of your policy statement. If the column includes a resource type, then you can specify an ARN of that type in a statement with that action. If the action has one or more required resources, the caller must have permission to use the action with those resources. Required resources are indicated in the table with an asterisk (*). If you limit resource access with the Resource element in an IAM policy, you must include an ARN or pattern for each required resource type. Some actions support multiple resource types. If the resource type is optional (not indicated as required), then you can choose to use one of the optional resource types.

The Condition keys column of the Actions table includes keys that you can specify in a policy statement's Condition element. For more information on the condition keys that are associated with resources for the service, see the Condition keys column of the Resource types table.

Note

Resource condition keys are listed in the Resource types table. You can find a link to the resource type that applies to an action in the Resource types (*required) column of the Actions table. The resource type in the Resource types table includes the Condition keys column, which are the resource condition keys that apply to an action in the Actions table.

For details about the columns in the following table, see Actions table.

Actions Description Access level Resource types (*required) Condition keys Dependent actions
OpenTunnel Grants permission to establish SSH connection to an EC2 instance using EC2 Instance Connect Endpoint Write

instance-connect-endpoint*

instance-connect-endpoint

aws:ResourceTag/${TagKey}

ec2:ResourceTag/${TagKey}

ec2-instance-connect:remotePort

ec2-instance-connect:privateIpAddress

ec2-instance-connect:MaxTunnelDuration

SendSSHPublicKey Grants permission to push an SSH public key to the specified EC2 instance to be used for standard SSH Write

instance*

ec2:osuser

SendSerialConsoleSSHPublicKey Grants permission to push an SSH public key to the specified EC2 instance to be used for serial console SSH Write

instance*

Resource types defined by Amazon EC2 Instance Connect

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 Resource types table. For details about the columns in the following table, see Resource types table.

Resource types ARN Condition keys
instance arn:${Partition}:ec2:${Region}:${Account}:instance/${InstanceId}

aws:ResourceTag/${TagKey}

ec2:ResourceTag/${TagKey}

instance-connect-endpoint arn:${Partition}:ec2:${Region}:${Account}:instance-connect-endpoint/${InstanceConnectEndpointId}

aws:ResourceTag/${TagKey}

ec2:ResourceTag/${TagKey}

Condition keys for Amazon EC2 Instance Connect

Amazon EC2 Instance Connect 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 Condition keys table.

To view the global condition keys that are available to all services, see Available global condition keys.

Condition keys Description Type
aws:ResourceTag/${TagKey} Filters access by tags associated with the resource String
ec2-instance-connect:maxTunnelDuration Filters access by maximum session duration associated with the instance Numeric
ec2-instance-connect:privateIpAddress Filters access by private IP Address associated with the instance IPAddress
ec2-instance-connect:remotePort Filters access by port number associated with the instance Numeric
ec2:ResourceTag/${TagKey} Filters access by tags associated with the resource String
ec2:osuser Filters access by specifying the default user name for the AMI that you used to launch your instance String