Search code examples
amazon-web-servicesamazon-s3boto3amazon-iam

Does role require AWS accesskey and password


I have a role and I am trying to write a python script to access S3. It says boto3exception credentials not found. Do I need an AWS access key and password and keep in ~./aws/credentials to access S3?


Solution

  • There are different ways in which you can supply credentials to boto3.

    From the documentation:

    The order in which Boto3 searches for credentials is:

    1. Passing credentials as parameters in the boto.client() method
    2. Passing credentials as parameters when creating a Session object
    3. Environment variables
    4. Shared credential file (~/.aws/credentials)
    5. AWS config file (~/.aws/config)
    6. Assume Role provider
    7. Boto2 config file (/etc/boto.cfg and ~/.boto)
    8. Instance metadata service on an Amazon EC2 instance that has an IAM role configured.

    these are evaluated in order. Whichever one evaluates to credentials will be used.