Configure AWS EC2 Resource ID Length

From Bonus Bits
Jump to: navigation, search

Purpose

This article gives the steps to enable or disable AWS EC2 Resource ID Length to the new longer version.


Information

  • If you login with an IAM User via the Web Console or CLI it will only make changes for that user.
  • Each Region must be configured individually
  • If you login as root to the AWS account it will change the settings for all the users if they have not made any configurations.


Web Console (Option 1)

  1. Login to AWS Web Console and Select EC2 Service
    https://console.aws.amazon.com/ec2/
  2. Select the region in the upper right that you'd like to make the change to
  3. Select Account Attributes | Resource ID length management
    EC2 Resource ID Length Management01
  4. Select or Unselect each of the four resource types you'd like to enable or disable
    EC2 Resource ID Length Management02


CLI (Option 2)

List current settings

  1. If we don't use AWS CLI profiles and have the environment variables configured for our single AWS Account you can simply type the following.
    aws ec2 describe-id-format
    
  2. If we have a AWS CLI profile that includes the region then we can simply use the profile argument.
    aws ec2 describe-id-format --profile dev
    
  3. If we don't have a profile that includes the region then you can specific the region.
    aws ec2 describe-id-format --region us-west-2
    
    aws ec2 describe-identity-id-format --principal-arn arn-of-iam-principal
    

Enable Long IDs

If your AWS CLI profile has the region set then just call the profile. Otherwise use --region xx-xxxx-x

  1. aws ec2 modify-id-format --resource instance --use-long-ids --profile dev
    
    aws ec2 modify-id-format --resource reservation --use-long-ids --profile dev
    
    aws ec2 modify-id-format --resource volume --use-long-ids --profile dev
    
    aws ec2 modify-id-format --resource snapshot --use-long-ids --profile dev
    

Disable Long IDs

If your AWS CLI profile has the region set then just call the profile. Otherwise use --region xx-xxxx-x

  1. aws ec2 modify-id-format --resource instance --no-use-long-ids --profile dev
    
    aws ec2 modify-id-format --resource reservation --no-use-long-ids --profile dev
    
    aws ec2 modify-id-format --resource volume --no-use-long-ids --profile dev
    
    aws ec2 modify-id-format --resource snapshot --no-use-long-ids --profile dev
    


Sources