AWS更改凭证文件位置?

问题描述

我的.aws /凭据位于与当前文件夹不同的位置,如何指定其他位置?

shift

解决方法

看来您正在使用 python boto 库

共享凭证文件的默认位置为 ~/.aws/凭证。您可以更改共享位置 通过设置 AWS_SHARED_CREDENTIALS_FILE 凭证文件 环境变量。

例如export AWS_SHARED_CREDENTIALS_FILE=mycustompath

然后运行你的python脚本

https://boto3.amazonaws.com/v1/documentation/api/latest/guide/credentials.html#:~:text=The%20shared%20credentials%20file%20has,section%20names%20corresponding%20to%20profiles