Unlike AWS_REGION
or AWS_LAMBDA_FUNCTION_NAME
, we cannot get current account id from the environment variables. In order to to get the account id, we can use boto3
library with the following code:
import boto3
client = boto3.client("sts")
account_id = client.get_caller_identity()["Account"]
标签:Account,get,Python,Get,AWS,account,boto3,id
From: https://www.cnblogs.com/grandyang/p/16652495.html