If you have multiple aws profiles in ~/.aws/credentials
like...
[Profile 1]
aws_access_key_id = *******************
aws_secret_access_key = ******************************************
[Profile 2]
aws_access_key_id = *******************
aws_secret_access_key = ******************************************
Follow two steps:
Make one you want to use as a default using export AWS_DEFAULT_PROFILE=Profile 1
command in terminal.
Make sure to run above command in the same terminal from where you use boto3 or you open an editor.[Understand the following scenario]
Scenario:
t1
and t2
.t1
and you open JupyterLab or any other from t2
, you will get NoCredentialsError: Unable to locate credentials error.Solution:
t1
and then open JupyterLab or any other from the same terminal t1
.