티스토리 뷰

공부

[boto3] boto3.Session().get_credentials()

승가비 2023. 1. 24. 05:58
728x90
def args_function(**kwargs):
    c = boto3.Session().get_credentials()

    p = kwargs["params"]

    return [c.access_key, c.secret_key, "ap-northeast-2", p["s3"], p["keyword"]]

https://stackoverflow.com/questions/41270571/is-there-a-way-to-get-access-key-and-secret-key-from-boto3

 

Is there a way to get access_key and secret_key from boto3?

When I launch an EC2 instance with an IAM role I can use boto3 on that EC2instance and not have to specify aws access and secret keys because boto3 reads them automatically. >>> import b...

stackoverflow.com

https://boto3.amazonaws.com/v1/documentation/api/latest/guide/credentials.html?highlight=credentials 

 

Credentials — Boto3 Docs 1.26.54 documentation

There are valid use cases for providing credentials to the client() method and Session object, these include: The first option for providing credentials to Boto3 is passing them as parameters when creating clients: The second option for providing credentia

boto3.amazonaws.com

 

728x90
댓글