我已经配置了无服务器架构的密钥和秘密。
当我尝试运行serverless deploy时,它会显示:
ServerlessError: AWS provider credentials not found. Learn how to set up AWS provider credentials in our docs here:.
请帮我该怎么做
我已经配置了无服务器架构的密钥和秘密。
当我尝试运行serverless deploy时,它会显示:
ServerlessError: AWS provider credentials not found. Learn how to set up AWS provider credentials in our docs here:.
请帮我该怎么做
以下是如何在本地设置AWS凭证:
<Access Key ID>
<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 AWS - Config Credentials documentation以获取有关Serverless的详细信息,并在需要确定凭据的情况下参阅this AWS document on security credentials。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
命令提示符不知道什么是~/ PATH,但Bash知道。
然后我运行了。 sls deploy -v
对于那些遇到相同问题的人,即使已经通过运行命令 serverless config credentials 来配置了 AWS 凭证,仍然存在问题。
我也曾遇到过同样的问题。即使在 serverless 上正确地设置了我的 AWS 凭证,当我运行 serverless deploy 命令时,我收到了以下错误提示:ServerlessError: 找不到 AWS 提供者凭证。
那么我是怎么解决它的呢?通过安装并配置 AWS CLI 工具。一旦我安装并用我的 AWS 凭证配置好了它之后,再次运行 serverless deploy 命令,它就可以正常工作了。
我猜测,在幕后,serverless 命令使用 AWS CLI 访问 AWS 并提供 AWS 资源。
我希望这对某些人有所帮助。