首页 > 解决方案 > Ubuntu、无服务器框架、AWS 凭证失败

问题描述

我似乎无法让我的 AWS 提供商在 Docker 容器中使用我的 AWS 凭证

到目前为止,我已经运行了所有这些

serverless config credentials --provider provider --key key --secret secret

&

aws configure

☝️浏览提示并插入我的信息

&

export AWS_ACCESS_KEY_ID=blah
export AWS_SECRET_ACCESS_KEY=blah
export AWS_DEFAULT_REGION=east-whatever

但是,仍然被 AWS 阻止

ServerlessError: AWS provider credentials not found. Learn how to set up AWS provider credentials in our docs here:.

我还生成并重新生成了我的 IAM 信用多次时间,当我运行aws configure list它时也会返回

      Name                    Value             Type    Location
      ----                    -----             ----    --------
   profile                <not set>             None    None
access_key     ****************67GT shared-credentials-file    
secret_key     ****************6glt shared-credentials-file    
    region                us-east-2      config-file    ~/.aws/config

我不知道还能做什么,我在 Ubuntu 20.04 上使用 Bash

标签: amazon-web-servicesaws-lambdaserverless-frameworkubuntu-20.04

解决方案


我将采取使用 aws-cli 设置所有内容的方法(因此 aws cli 安装是 imp)

  • 安装 aws cli
  • 运行aws configure-> 输入您的凭据,此信息将存储default 在 ~/.aws/credentials 文件中调用的配置文件中。文档
  • 通过检查~/.aws/config ~/.aws.credentials文件来验证您的配置
  • 对于无服务器框架部署,请使用此serverless deploy.
  • 如果需要使用多个配置文件,请使用sls deploy --aws-profile profile-name

推荐阅读