sts updates
This commit is contained in:
14
libs/sts.py
14
libs/sts.py
@@ -16,3 +16,17 @@ def get_accountid(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY):
|
|||||||
print("CTRL-C received, exiting...")
|
print("CTRL-C received, exiting...")
|
||||||
|
|
||||||
return account_id
|
return account_id
|
||||||
|
|
||||||
|
def get_accountid_all(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY):
|
||||||
|
try:
|
||||||
|
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"]
|
||||||
|
account_userid = client.get_caller_identity()["UserId"]
|
||||||
|
account_arn = client.get_caller_identity()["Arn"]
|
||||||
|
print("Account Id: {}" .format(account_id))
|
||||||
|
print("Account UserID: {}" .format(account_userid) )
|
||||||
|
print("Account ARN: {}" .format(account_arn) )
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
print("CTRL-C received, exiting...")
|
||||||
|
|
||||||
|
return account_id
|
||||||
8
sts_get_account_id.py
Normal file
8
sts_get_account_id.py
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
'''
|
||||||
|
This file is used to perform some EMR actions
|
||||||
|
'''
|
||||||
|
from libs.sts import *
|
||||||
|
from config import AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY
|
||||||
|
|
||||||
|
get_accountid(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY)
|
||||||
|
get_accountid_all(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY)
|
||||||
Reference in New Issue
Block a user