(aws-lambda): Use PoLP inline IAM policies instead of AWS managed policies
- Dominant language
- TypeScript
- Stars
- 12.9k
- Forks
- 4.6k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 83
Description
### Describe the feature
Lambdas are created with inline policies that follow PoLP instead of AWS managed policies.
### Use Case
Currently Lambdas are created with AWS managed policies for logging and VPC access.
AWS managed policies used by the CDK:
- `AWSLambdaBasicExecutionRole`
- `AWSLambdaVPCAccessExecutionRole`
In most cases AWS managed policies are considered [overly permissive](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#bp-use-aws-defined-policies) and customer managed policies should be used in their place.
Lambdas should be created with sensible defaults based on AWS best practices.
### Proposed Solution
The CDK creates Lambdas without using AWS managed policies. Instead, it uses custom inline policies based on the PoLP.
### Other Information
Existing GitHub [discussion](https://github.com/aws/aws-cdk/discussions/22123)
### Acknowledgements
- [ ] I may be able to implement this feature request
- [ ] This feature might incur a breaking change
### CDK version used
2.162.1
### Environment details (OS name and version, etc.)
Ubuntu 24.04.1
Contributor guide
Assessment
This issue has not been assessed yet.