Skip to content

Instantly share code, notes, and snippets.

@andresriancho
Last active August 27, 2023 21:46
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
Get AWS root account email address
import boto3
session = boto3.Session(profile_name='ariancho')
s3_client = session.client('s3')
display_name = s3_client.list_buckets()['Owner']['DisplayName']
print(display_name)
for bucket in s3_client.list_buckets()['Buckets']:
print(s3_client.get_bucket_acl(Bucket=bucket['Name'])['Owner']['DisplayName'])
@andresriancho
Copy link
Author

$ python3 get-display-name.py
andres.riancho+aws001
andres.riancho+aws001

@andresriancho
Copy link
Author

From Ben Bridts:

# Works if the AWS account has support cases
aws support describe-cases --region us-east-1 --include-resolved-cases --query cases[0].submittedBy --output text

# Works if the AWS credentials have privileges for AWS organizations and the credentials are associated with the AWS organization master account
aws organizations --profile root describe-account --account-id $(aws sts get-caller-identity --query Account --output text) --query Account.Email --output text

@andresriancho
Copy link
Author

Another potential location for the AWS account root email address is SNS subscriptions.

aws sns list-subscriptions

@j0nathontayl0r
Copy link

If your AWS accounts are attached to an AWS Organisation, you can also see the aws root email address in the OU screen in the tree view:

https://us-east-1.console.aws.amazon.com/organizations/v2/home/accounts

This should list the root email of all of your Organisations associated accounts.

@mikegrima
Copy link

@andresriancho Good call on the support cases!

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