Use DescribeIdentityIdFormat with an Amazon SDK or CLI - Amazon Elastic Compute Cloud
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Use DescribeIdentityIdFormat with an Amazon SDK or CLI

The following code examples show how to use DescribeIdentityIdFormat.

CLI
Amazon CLI

To describe the ID format for an IAM role

The following describe-identity-id-format example describes the ID format received by instances created by the IAM role EC2Role in your Amazon account.

aws ec2 describe-identity-id-format \ --principal-arn arn:aws:iam::123456789012:role/my-iam-role \ --resource instance

The following output indicates that instances created by this role receive IDs in long ID format.

{ "Statuses": [ { "Deadline": "2016-12-15T00:00:00Z", "Resource": "instance", "UseLongIds": true } ] }

To describe the ID format for an IAM user

The following describe-identity-id-format example describes the ID format received by snapshots created by the IAM user AdminUser in your Amazon account.

aws ec2 describe-identity-id-format \ --principal-arn arn:aws:iam::123456789012:user/AdminUser \ --resource snapshot

The output indicates that snapshots created by this user receive IDs in long ID format.

{ "Statuses": [ { "Deadline": "2016-12-15T00:00:00Z", "Resource": "snapshot", "UseLongIds": true } ] }
PowerShell
Tools for PowerShell

Example 1: This example returns the ID format for the resouce 'image' for the role given

Get-EC2IdentityIdFormat -PrincipalArn arn:aws:iam::123456789511:role/JDBC -Resource image

Output:

Deadline Resource UseLongIds -------- -------- ---------- 8/2/2018 11:30:00 PM image True

For a complete list of Amazon SDK developer guides and code examples, see Create Amazon EC2 resources using an Amazon SDK. This topic also includes information about getting started and details about previous SDK versions.