似乎没有配置 AWS 配置文件!无服务器框架错误? [英] AWS profile doesn't seem to be configured! Serverless framework error?

查看:50
本文介绍了似乎没有配置 AWS 配置文件!无服务器框架错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

背景:-我有一个网关帐户(没有权限),其中创建了用户,为了访问 aws 资源,我们使用具有管理员访问权限的角色.

Background:-I have a gateway account( with no permissions) in which users are created and in order to access aws resources we use roles having admin access.

配置文件

[profile gateway]
region = ap-southeast-1
output = json

[profile DA]

region = ap-south-1
output = json
role_arn = arn:aws:iam::xxxxxxxxxxxxx:role/jatin
mfa_serial = arn:aws:iam::xxxxxxxxxx:mfa/atin
source_profile = gateway

凭证文件

[gateway]
aws_access_key_id=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
aws_secret_access_key=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

现在我正在尝试使用无服务器部署 --aws-profile DA"来部署我的 lambda,它说 AWS profile DA"好像没有配置

Now I am trying to deploy my lambda using serverless deploy --aws-profile "DA", it says AWS profile "DA" doesn't seem to be configured

但是,如果我运行 aws s3 ls --profile "DA" 它可以完美运行,所以我想配置文件和凭据的配置没有问题

however, if I run aws s3 ls --profile "DA" its works perfectly, so i guess there is no problem with the configuration of profiles and credentials

推荐答案

这是 Serverless 的一个已知问题,Serverless 只检查 ~/.aws/credentials 的配置文件而不是 ~/.aws/config.

This is a known issue with Serverless, Serverless only checks ~/.aws/credentials for the profile and not ~/.aws/config.

有多个关于此的无服务器论坛帖子,例如这个.

There are multiple Serverless forum posts about this, e.g. this one.

将您的 ~/.aws/credentials 文件更改为此,它应该可以工作:

Change your ~/.aws/credentials file to this and it should work:

[gateway]
aws_access_key_id=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
aws_secret_access_key=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

[DA]
aws_access_key_id=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
aws_secret_access_key=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
role_arn = arn:aws:iam::xxxxxxxxxxxxx:role/jatin
mfa_serial = arn:aws:iam::xxxxxxxxxx:mfa/atin
source_profile = gateway

这篇关于似乎没有配置 AWS 配置文件!无服务器框架错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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