Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Boto3: Configuration file location

Is there any way to have Boto seek for the configuration files other than the default location, which is ~/.aws?

like image 387
d-_-b Avatar asked Nov 27 '15 06:11

d-_-b


People also ask

Where is boto3 stored?

The location of the config file used by Boto3. By default this value is ~/. aws/config .

Where is boto3 AWS credentials?

The shared credentials file has a default location of ~/. aws/credentials . You can change the location of the shared credentials file by setting the AWS_SHARED_CREDENTIALS_FILE environment variable.

How do I create a Boto file?

In Windows, create a text file that has any name (e.g. boto. config). It's recommended that you put this file in your user folder. Then set a user environment variable named BOTO_CONFIG to the full path of that file.


2 Answers

It's not clear from the question whether you are talking about boto or boto3. Both allow you to use environment variables to tell it where to look for credentials and configuration files but the environment variables are different.

In boto3 you can use the environment variable AWS_SHARED_CREDENTIALS_FILE to tell boto3 where your credentials file is (by default, it is in ~/.aws/credentials. You can use AWS_CONFIG_FILE to tell it where your config file is (by default, it is in ~/.aws/config.

In boto, you can use BOTO_CONFIG to tell boto where to find its config file (by default it is in /etc/boto.cfg or ~/.boto.

like image 154
garnaat Avatar answered Sep 29 '22 01:09

garnaat


Yes, you can install the configuration file (for site-wide settings that all users on this machine will use) in:

nano /etc/boto.cfg
[Credentials]
aws_access_key_id = your_key
aws_secret_access_key = your_password

Other possible locations could be:

  • (if profile is given) ~/.aws/credentials for credentials shared between SDKs
  • (if profile is given) ~/.boto for user-specific settings
  • ~/.aws/credentials for credentials shared between SDKs
  • ~/.boto for user-specific settings
like image 20
VinsanityL Avatar answered Sep 29 '22 02:09

VinsanityL