aws / aws/aws-cdk

(aws-lambda): Lambda shareable events

Open
#19,471 4 comments 28 reactions 0 assignees View on GitHub
@aws-cdk/aws-lambda effort/medium feature-request p1
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
2d 3h
Merged PRs (30d)
83

Description

### Description

[Shareable test events](https://docs.aws.amazon.com/lambda/latest/dg/testing-functions.html#creating-shareable-events) is now available in the Lambda console. All you need to do it is setup an [Amazon EventBridge schema registry](https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-schema-registry.html) called `lambda-testevent-schemas` and then create schemas with examples with the following naming convention `_-schema`.

### Use Case

Allows you to quickly populate shareable events on your `dev`, `test` and `stage` environments

### Proposed Solution

From a UX point of view, we could simply things by just asking for the sample events you want to add ie:

```python
function.add_shareable_test_event("test_pass", test_pass_event)
function.add_shareable_test_event("test_fail", test_fail_event)
```

And to be future proof also allow for a full schema definition.

This would use a CloudFormation Custom resource under the schemas to setup these test events (as well as ensure the required registry is created). In the future, hopefully official CloudFormation support will be coming.

A prototype for this exists here: [Lambda shareable test events](https://lambda.101i.de/lambda-resources/#lambda-shareable-test-events)

### Other information

- https://docs.aws.amazon.com/lambda/latest/dg/testing-functions.html#creating-shareable-events

### Acknowledge

- [X] I may be able to implement this feature request
- [ ] This feature might incur a breaking change

Contributor guide

Open the contributing guide

Research direction

Start with the AWS Lambda shareable test events and EventBridge schema registry documentation, then review the linked prototype for the proposed API and custom-resource approach. Done should include creating the required registry and named schemas for the requested events, while supporting a full schema definition and verifying the behavior across dev, test, and stage environments.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, typescript
Domain
cloud, infrastructure
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.