-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Share a single lambda service role across all lambda functions
This reduces the chance of reaching the AWS service quota limit of 1000 IAM roles per account when deploying many stacks with multiple lambdas per stack.
- Loading branch information
1 parent
c85843b
commit cb2b17d
Showing
5 changed files
with
62 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import type {Stack} from 'aws-cdk-lib'; | ||
|
||
import {aws_iam} from 'aws-cdk-lib'; | ||
|
||
export function createLambdaServiceRole(stack: Stack): aws_iam.IRole { | ||
return new aws_iam.Role(stack, `LambdaServiceRole`, { | ||
assumedBy: new aws_iam.ServicePrincipal(`lambda.amazonaws.com`), | ||
managedPolicies: [ | ||
aws_iam.ManagedPolicy.fromAwsManagedPolicyName( | ||
`service-role/AWSLambdaBasicExecutionRole`, | ||
), | ||
aws_iam.ManagedPolicy.fromAwsManagedPolicyName(`AWSXrayWriteOnlyAccess`), | ||
], | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters