簡體   English   中英

AWS Lambda 無服務器部署要求 AWS 提供商憑證

[英]AWS Lambda Serverless deploy asking for AWS provider credentials

我已經用密鑰和秘密配置了無服務器。

當我嘗試運行無服務器部署時,它說:

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

請幫我做什么

這是在本地設置 AWS 憑證的方法:

  1. 登錄 AWS 控制台
  2. 轉到您的 AWS 賬戶概覽
  3. 右上角的帳戶菜單(上面有您的名字)
  4. 子菜單:安全憑證
  5. 復制<Access Key ID>
  6. 復制<Secret Access Key>
  7. 在本地serverless config credentials --provider aws --key <Access Key ID> --secret <Secret Access Key>上運行serverless config credentials --provider aws --key <Access Key ID> --secret <Secret Access Key>

您可以通過使用serverless config credentials命令,使用--provider aws並使用--key--secret分別設置您的 AWS 訪問密鑰 ID 和秘密訪問密鑰來設置您的serverless config credentials

請參閱Serverless AWS - Config Credentials 文檔以了解 Serverless 的詳細信息,以及有關安全憑證的此 AWS 文檔,以防您需要弄清楚您的憑證是什么。

還要在您的 yml 文件中提供您的個人資料和區域配置

provider:
  name: aws
  runtime: python2.7
  lambdaHashingVersion: 20201221
  profile: 'serverless-admin'
  region: 'us-east-1'

我有同樣的問題。 我嘗試一切。 我使用 aws cli 和 serverless cli 配置了我的憑證(AWS 密鑰和密鑰),但在運行時仍然出現相同的錯誤:

sls deploy -v

我在使用 CMD 之前我在運行命令時意識到了一些事情

aws configure list

輸出是

 Name                    Value             Type    Location
      ----                    -----             ----    --------
   profile                <not set>             None    None
access_key     ****************SOU5 shared-credentials-file
secret_key     ****************Cki5 shared-credentials-file
    region                eu-west-1      config-file    ~/.aws/config

配置文件的路徑是

~/.aws/config

CMD 不知道 ~/ PATH 是什么,但 Bash 知道

😈

然后我運行

 sls deploy -v

在 bash 終端上運行了 🎉🙌🙌🎉🐱‍🏍

對於那些有同樣問題的人,即使已經為無服務器配置了 AWS 憑證,也可以運行命令 serverless config credentials:

我有同樣的問題; 即使我在無服務器上正確設置了我的 AWS 憑證,當我運行無服務器部署命令時,我也得到了這個:ServerlessError: AWS provider credentials not found。

我是怎么解決的? 通過安裝和配置 AWS CLI 工具 一旦我安裝它並使用我的 AWS 憑證配置它,然后再次運行無服務器部署命令,它就可以正常工作。

我想無服務器命令在幕后使用 AWS CLI 訪問 AWS 並配置 AWS 資源。

我希望這對某人有幫助。

暫無
暫無

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

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