lost Coder
lost Coder

Reputation: 577

How to get the Amazon account email info in AWS lambda

I am using a lambda function in Amazon. Is there a way to get the email id linked to the AWS account from python code in lambda function.

Upvotes: 1

Views: 220

Answers (1)

John Rotenstein
John Rotenstein

Reputation: 269826

The describe-organization command in the AWS Command-Line Interface (CLI) returns this information:

aws organizations describe-organization

Output:

{
  "Organization": {
    "MasterAccountArn": "arn:aws:organizations::111111111111:account/o-exampleorgid/111111111111",
    "MasterAccountEmail": "[email protected]",
    "MasterAccountId": "111111111111",
    "Id": "o-exampleorgid",
    "FeatureSet": "ALL",
    "Arn": "arn:aws:organizations::111111111111:organization/o-exampleorgid",
    "AvailablePolicyTypes": [
      {
        "Status": "ENABLED",
        "Type": "SERVICE_CONTROL_POLICY"
    ]
  }
}

AWS Organizations was introduced in early 2017 as a means of managing multiple AWS Accounts in a hierarchy.

See: AWS Organizations Documentation

Upvotes: 1

Related Questions