在AWS CLI上找不到IAM凭证 [英] IAM credentials not found on AWS CLI

查看:175
本文介绍了在AWS CLI上找不到IAM凭证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试自动将db备份上传到ubuntu机器上的s3.我有正确生成的数据库备份,但是当我尝试上传到s3时,出现以下错误:

I'm trying to automate a db backup upload to s3 on an ubuntu machine. I have the db backup generating correctly, but when I try to upload to s3 I get the following error:

 A client error (InvalidAccessKeyId) occurred when calling the PutObject 
operation: The AWS Access Key Id you provided does not exist in our records.

我使用了命令行aws configure命令来配置我的凭据,然后打开〜/.aws/config文件并确保它是正确的.我也跑了

I used the command line aws configure command to configure my credentials, then opened the ~/.aws/config file and made sure it was correct. I also ran

aws configure list

并收到以下信息:

      Name                    Value             Type    Location
    ----                    -----             ----    --------
   profile                <not set>             None    None
   access_key     ****************B6YQ      config_file    ~/.aws/config
   secret_key     ****************Vstu      config_file    ~/.aws/config
   region               cn-north-1      config_file    ~/.aws/config

当这不起作用时,我尝试为root用户和IAM用户都重新生成新的凭据,但这仍然不起作用. 我尝试了IAM模拟器,以查看S3 put命令是否可以正常工作.

When that didn't work I tried regenerating new credentials for both the root user and the IAM user, but that still didn't work. I tried the IAM simulator to see if the S3 put command would work and it did.

有人对我能做什么有任何想法吗?

Does anyone have any ideas as to what I can do?

推荐答案

来自

AWS CLI使用供应商链在许多不同的地方查找AWS凭证,包括系统或用户环境变量以及本地AWS配置文件.

The AWS CLI uses a provider chain to look for AWS credentials in a number of different places, including system or user environment variables and local AWS configuration files.

AWS CLI按以下顺序查找凭证和配置设置:

The AWS CLI looks for credentials and configuration settings in the following order:

  1. 命令行选项 –可以将区域,输出格式和配置文件指定为命令选项,以覆盖默认设置.

  1. Command Line Options – region, output format and profile can be specified as command options to override default settings.

环境变量AWS_ACCESS_KEY_IDAWS_SECRET_ACCESS_KEY

AWS凭证文件 –在Linux,macOS或Unix上位于~/.aws/credentials,在Windows上位于C:\Users\USERNAME \.aws\credentials.除了默认配置文件之外,此文件还可以包含多个命名的配置文件.

The AWS credentials file – located at ~/.aws/credentials on Linux, macOS, or Unix, or at C:\Users\USERNAME \.aws\credentials on Windows. This file can contain multiple named profiles in addition to a default profile.

CLI配置文件 –通常位于Linux,macOS或Unix上的~/.aws/config或Windows上的C:\Users\USERNAME \.aws\config上.该文件可以包含默认配置文件,命名配置文件以及每个配置文件的CLI特定配置参数.

The CLI configuration file – typically located at ~/.aws/config on Linux, macOS, or Unix, or at C:\Users\USERNAME \.aws\config on Windows. This file can contain a default profile, named profiles, and CLI specific configuration parameters for each.

实例配置文件凭证 –这些凭证可用于具有指定实例角色的EC2实例,并通过Amazon EC2元数据服务提供.

Instance profile credentials – these credentials can be used on EC2 instances with an assigned instance role, and are delivered through the Amazon EC2 metadata service.

还可能设置了AWS_DEFAULT_PROFILE,它会覆盖配置文件中使用的凭据.

It is also possible that you have the AWS_DEFAULT_PROFILE set, which overrides which credentials are used in the configuration file.

这篇关于在AWS CLI上找不到IAM凭证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆