【发布时间】:2020-10-07 03:19:52
【问题描述】:
我正在使用 AWS SAM 将我的 AWS Lambda 函数部署到 AWS。
我能够在 Globals 部分中定义一次 Runtime,我想知道是否可以为我的 Lambda 承担的 AWS 角色定义一个常量 (Role: arn:aws:iam::12345678:role/lambda-role),目前在每个函数的模板文件。
这是我的 SAM 模板:
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Globals:
Function:
Runtime: python3.7
Resources:
FunctionA:
Type: AWS::Serverless::Function
Properties:
CodeUri: lambdas/
Handler: app.event_handler_a
Role: arn:aws:iam::12345678:role/lambda-role
FunctionB:
Type: AWS::Serverless::Function
Properties:
CodeUri: lambdas/
Handler: app.event_handler_b
Role: arn:aws:iam::12345678:role/lambda-role
【问题讨论】:
标签: amazon-web-services aws-lambda amazon-cloudformation