sts cleanup

This commit is contained in:
carnal0wnage
2017-06-27 22:01:44 -04:00
parent a4bcc94d99
commit 2935c695b6
2 changed files with 0 additions and 1 deletions

18
libs/sts.py Normal file
View File

@@ -0,0 +1,18 @@
import boto3
import botocore
import pprint
pp = pprint.PrettyPrinter(indent=5, width=80)
#from http://docs.aws.amazon.com/general/latest/gr/rande.html
regions = ['us-east-1', 'us-east-2', 'us-west-1', 'us-west-2', 'ca-central-1', 'eu-central-1', 'eu-west-1', 'eu-west-2', 'ap-northeast-1', 'ap-northeast-2', 'ap-southeast-1', 'ap-southeast-2', ]
AWS_ACCESS_KEY_ID = ''
AWS_SECRET_ACCESS_KEY = ''
def get_accountid(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY):
client = boto3.client("sts", aws_access_key_id=AWS_ACCESS_KEY_ID, aws_secret_access_key=AWS_SECRET_ACCESS_KEY)
account_id = client.get_caller_identity()["Account"]
return account_id