Instantly share code, notes, and snippets.

Embed
What would you like to do?
Enable long instance, reservation, snapshot, and volume IDs across all AWS regions.
#!/bin/bash
REGIONS=`aws ec2 describe-regions --region us-east-1 --output text | awk '{print $3}'`
for r in $REGIONS; do
echo "Enabling long IDs for instnaces and reservations in $r"
aws ec2 modify-id-format --resource instance --use-long-ids --region $r
aws ec2 modify-id-format --resource reservation --use-long-ids --region $r
aws ec2 modify-id-format --resource snapshot --use-long-ids --region $r
aws ec2 modify-id-format --resource volume --use-long-ids --region $r
done
@ranrotx

This comment has been minimized.

Copy link
Owner Author

ranrotx commented Jan 14, 2016

From AWS console: These changes apply to the entire account UNLESS you are logged in as an IAM user. If you are logged in as an IAM user, these settings will only apply to that user. If you are logged in as an IAM role or as the root user, these changes will apply across the account.

Based on the above, if you want this change to take effect across your entire account, you may need to run from an EC2 instance using an IAM role or using access keys/secret keys from the root user (not recommended).

@ranrotx

This comment has been minimized.

Copy link
Owner Author

ranrotx commented Apr 29, 2016

Added in snapshot and volume as a resource type.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment