Daniel Ponce
Daniel Ponce

Reputation: 1

How to get Contact Information and Alternate Contact in AWS/Billing using boto3?

I am working on a project in which through the boto3 SDK I need to obtain the information from Alternate Contacts and Contact Information.

Is there a method that do this with boto3? Thanks!

Upvotes: 0

Views: 1209

Answers (3)

user2464429
user2464429

Reputation: 1

The current version of boto provides an method for requesting the Alternate Contact information:

import boto3

CONTACT_TYPES = ['BILLING','OPERATIONS','SECURITY']
        
client = boto.client('account')
        
alternate_contact = client.get_alternate_contact(
    AccountId=event['AccountId'],
    AlternateContactType=CONTACT_TYPES[0])

Upvotes: 0

LRutten
LRutten

Reputation: 1902

Yeah I've run into that problem many times before. When dealing with large scale organizations this is kindof a bottleneck sometimes. It's currently not possible to automate easily.

Some corporates I've seen get around this by tagging account's with a 'BillingContact' and 'Technical Contact's etc. and build their own logic around those tags using lambda's. This doesn't help in letting account's owners receive messages from AWS directly, but it gives some possibilities to email account owners using your own logic to have some form of governance.

Upvotes: 0

bembas
bembas

Reputation: 771

To fetch account data you can use describe_account function.

If the contact information are not in the response of describe account then i dont think is possible to fetch those info via SDK.

import boto3

client = boto3.client('organizations')

response = client.describe_account(
    AccountId='string'
)

Upvotes: 1

Related Questions