似乎没有配置AWS配置文件!无服务器框架错误?

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

配置文件

[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" doesn't seem to be configured

但是,如果我aws s3 ls --profile "DA"完美地运行它的作品,那么我想配置文件和凭据的配置没有问题

回答

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

有多个关于此的 Serverless 论坛帖子,例如 this one。

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

[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

  • However yesterday i tried this `export AWS_SDK_LOAD_CONFIG=1`
    then execute
    `serverless deploy --aws-profile myrole` somehow it worked https://stackoverflow.com/a/57707059/13126651
    but i am not satisfied with explanation as to why this worked can @yvesonline look into this?

以上是似乎没有配置AWS配置文件!无服务器框架错误?的全部内容。
THE END
分享
二维码
< <上一篇
下一篇>>