小编Ste*_*n M的帖子

使用 aws 角色执行无服务器部署

我正在尝试使用无服务器框架部署一个简单的 lambda 函数。我的 IAM 用户没有运行 cloudformation 的必要权限:

User: arn:aws:iam::xxx:user/xxx is not authorized to perform: cloudformation:DescribeStacks on resource: arn:aws:cloudformation:us-east-1:xxx:stack/xx
Run Code Online (Sandbox Code Playgroud)

这或多或少是有意为之,因为我们的设置使用 IAM 角色来执行某些任务。我已经在 ~/.aws/config 文件中配置了这些角色,对于 aws cli 操作,我可以调用

aws s3 ls --profile myrole
Run Code Online (Sandbox Code Playgroud)

通过这种方式,我将角色“myrole”中的所有策略附加到我的 IAM 用户以执行 aws-cli 命令。

有没有什么方法可以为无服务器做类似的事情,即将角色(不是不同的用户)附加到

serverless depoly 
Run Code Online (Sandbox Code Playgroud)

陈述?

如果我通过导出更改角色

AWS_PROFILE=myrole

或打电话

serverless deploy --aws-profile myrole

我得到Error: Profile myrole does not exist即使的角色定义 /.aws/credentials~/.aws/config

amazon-web-services amazon-iam serverless-framework serverless aws-serverless

3
推荐指数
1
解决办法
2571
查看次数