aws / aws/aws-cdk

aws-rds: Lambda invocation role support

Open
#14,751 6 comments 2 reactions 0 assignees View on GitHub
@aws-cdk/aws-rds effort/medium feature-request mixins p3
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
2d 3h
Merged PRs (30d)
83

Description

RDS recently added support for [invoking lambda functions from within a postgres instance](https://aws.amazon.com/about-aws/whats-new/2021/04/amazon-rds-postgresql-integrates-aws-lambda). There's a certain amount of boilerplate necessary to set this up, including [assigning a role to the database instance](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/PostgreSQL-Lambda.html#PostgreSQL-Lambda-access) to control which lambda functions can be invoked. I don't believe there is any way to set this up currently using CDK. There's analogous support for setting up S3 import/export roles, as well as monitoring roles.

### Use Case
Currently all my database setup is included in my CDK app and I would like to keep it that way. Without support in CDK I have to manually run `aws rds add-role-to-db-instance` using the aws cli.

### Proposed Solution
Either support a flexible `initialPolicy` prop on RDS instances where an inline policy can be defined, or a named prop like `lambdaInvocationPolicy` with more focused support (though I'm not sure what the API would look like).

### Other
If there's an interim option for setting this up using the "layer 1" type api's I would love to hear about it.

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the RDS instance APIs and the analogous S3 import/export and monitoring role support mentioned in the issue, including the available layer 1 APIs. Define how Lambda invocation roles should be exposed, then verify that the resulting CDK configuration supports the described PostgreSQL setup without manual AWS CLI commands.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, postgresql
Domain
cloud, databases
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.