【发布时间】:2019-02-24 02:02:27
【问题描述】:
我喜欢在部署模板时创建角色 + 内联策略的方式:
资源:
MyFUnction:
Type: AWS::Serverless::Function # More info about Function Resource: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction
Properties:
Description: Enter description of what this specific Lambda does
CodeUri: hello_world/build/
Handler: app.lambda_handler
Runtime: python2.7
Environment: # More info about Env Vars: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#environment-object
Variables:
PARAM1: VALUE
Policies:
# Using AWSLambdaExecute automatically creates a role named: <StackName>Role-<UUID>
- AWSLambdaExecute
# This policy is assigned as an Inline policy to the role
- Version: '2012-10-17' # Policy Document
Statement:
Effect: Allow
Action: ......
现在我可以引用动态创建的角色并在 SAM 模板中添加一个 Output: for it 吗?
【问题讨论】:
-
文档似乎没有为您提供检索 IAM 执行角色的方法。如果绝对需要,您也许可以编写 CloudFormation 宏来获取此信息。你确定你真的需要它吗?我原以为它在这个特定的无服务器部署内部。
-
并不真正需要它,但我喜欢我的输出以获取此信息 - 很高兴拥有此信息
标签: amazon-web-services aws-lambda amazon-cloudformation aws-sam-cli aws-sam