agent: |
DqbjNRY1i71fLJzeHzjNFetch the AWS Account ID using STS
Fetch the AWS Account ID using STS
There was a problem that the LLM was not able to address. Please rephrase your prompt and try again.
Retrieve the AWS account ID by calling the AWS Security Token Service (STS) to ensure secure identification and access management.
inputs
outputs
import boto3
creds = _get_creds(cred_label)['creds']
access_key = creds['username']
secret_key = creds['password']
def fetch_account_id():
sts_client = boto3.client('sts',aws_access_key_id=access_key,aws_secret_access_key=secret_key,region_name="us-east-1")
account_id = sts_client.get_caller_identity()['Account']
return account_id
account_id = fetch_account_id()
#print(account_id)
copied