【发布时间】:2021-01-12 11:00:42
【问题描述】:
是否可以在 AWS CloudFormation 中为 AWS Lambda 的 LambdaExecutionRole 编写自定义权限边界策略?
如果我可以在这段代码中为LambdaExecutionRole 编写所有必要的策略而不是使用!Ref 或!Sub,那可能是最好的。
请参阅PermissionBoundary 部分
(由于权限边界部分配置错误,此代码不起作用)
LambdaExecutionRole:
Description: Creating service role in IAM for AWS Lambda
Type: AWS::IAM::Role
Properties:
RoleName: !Sub 'CodeStar-${ProjectId}-Execution${Stage}'
AssumeRolePolicyDocument:
Statement:
- Effect: Allow
Principal:
Service: [lambda.amazonaws.com]
Action: sts:AssumeRole
Path: /
ManagedPolicyArns:
- !Sub 'arn:${AWS::Partition}:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole'
PermissionsBoundary: !Sub
Properties:
PolicyDocument:
Statement:
- Action:
- logs:CreateLogGroup
- logs:CreateLogStream
- logs:DescribeLogGroups
- logs:PutLogEvents
- xray:Put*
Effect: Allow
Resource: '*'
【问题讨论】:
标签: amazon-web-services amazon-cloudformation