Last active
October 18, 2024 15:00
-
-
Save andresriancho/f257ba10fee340243cfa3a775aa3eaba to your computer and use it in GitHub Desktop.
Get AWS root account email address
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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']) |
Author
andresriancho
commented
Sep 10, 2019
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
Another potential location for the AWS account root email address is SNS subscriptions.
aws sns list-subscriptions
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.
@andresriancho Good call on the support cases!
Much appreciated guys for the provided answers. Exactly what i was looking for
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment