【问题标题】:AWS CLI "$ aws configure" creates .awsconfig and .awscredentials files instead of .aws/config and .aws/credenatialsAWS CLI "$ aws configure" 创建 .awsconfig 和 .awscredentials 文件,而不是 .aws/config 和 .aws/credenatials
【发布时间】:2021-12-14 00:33:09
【问题描述】:

在 AWS CLI 中配置我的访问密钥时,凭证和配置文件创建存在问题。使用"$ aws configure --profile xxxxx" 命令时。 它曾经工作正常,"$ aws configure --profile xxxxx" 将创建 .aws/config 和 .aws/credentials 文件,通过这些文件我可以运行任何 aws 命令,同时通过 cli 在任何驱动器或文件夹中。 我卸载并重新安装了最新版本的 AWS CLI。 现在"$ aws configure --profile xxxxx" 刚刚在相同的旧路径(C:\Users\Profile)中创建了 .awsconfig 和 .awscredentials 文件。

  • 我可以运行任何 aws 命令并获得所需的输出。
  • 但是,当我更改路径时,比如移动到另一个文件夹,它会出现错误"The config profile (xxxxx) could not be found".

AWS 中没有关于此问题的文档。

【问题讨论】:

  • 您是否在某处设置了AWS_CONFIG_FILEdocs.aws.amazon.com/cli/latest/userguide/…
  • @DanielScott 是的,谢谢。我能够找到问题所在。我想设置环境变量,所以使用了 $setx 命令 $setx AWS_ACCESS_KEY_ID $setx AWS_SECRET_ACCESS_KEY $setx AWS_DEFAULT_REGION $setx AWS_PROFILE $setx $AWS_CREDENTIAL_FILE $setx $AWS_CONFIG_FILE 所以每当我尝试 $aws 配置,而不是 .aws 文件夹时,.awsconfig和 .awscredentials 文件被创建,它们不是全局的。通过使用 $unset ,我能够删除所有这些,并且 $aws configure 现在会创建包含配置和凭据文件的文件夹 .aws。

标签: amazon-web-services aws-cli


【解决方案1】:

我能够找到问题所在。我想设置环境变量,所以使用 $setx 命令

$setx AWS_ACCESS_KEY_ID 
$setx AWS_SECRET_ACCESS_KEY 
$setx AWS_DEFAULT_REGION 
$setx AWS_PROFILE 
$setx AWS_CREDENTIAL_FILE 
$setx AWS_CONFIG_FILE

因此,每当我尝试使用 $aws configure 而不是 .aws 文件夹时,都会创建非全局的 .awsconfig 和 .awscredentials 文件。通过使用$unset,我能够删除所有这些,$aws configure 现在创建folder .aws with config and credentials files.

希望这会有所帮助。 @丹尼尔斯科特

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-11-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多