簡體   English   中英

為什么 boto3 (AWS) 不使用 ~/.aws/credentials?

[英]Why isn't boto3 (AWS) using ~/.aws/credentials?

我的問題是 AWS boto3 package,授權,python。

參考https://boto3.amazonaws.com/v1/documentation/api/latest/guide/credentials.html部分:“配置憑證”boto3 實例的 aws 憑證可以從“4. 共享憑證文件( ~/.aws/credentials )”

為了證明~/.aws/credentials有效且足夠,我正在使用 aws cli( secretsmanager: create-secret, get-secret-value調用)。 響應/結果正常。

python 代碼中的 boto3 實例並非如此(使用client.get_secret_value )。

預期:無錯誤響應

實際上:

botocore.exceptions.ClientError: An error occurred
(UnrecognizedClientException) when calling the GetSecretValue
 operation: The security token included in the request is invalid.

任何提示表示贊賞,thnx。

問題的原因和解決方案:我忘記檢查我的 IDE 解釋器環境設置,它在 IDE 執行代碼時覆蓋了用戶的操作系統環境。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM