aws / aws/aws-cdk

(pipelines): Allow using S3 Event Notifications as pipeline trigger.

Open
#26,894 2 comments 1 reaction 0 assignees View on GitHub
@aws-cdk/pipelines effort/medium feature-request p2
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
2d 3h
Merged PRs (30d)
83

Description

### Describe the feature

Currently, the S3 triggers that CDK Pipelines support are described here:
https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline_actions.S3Trigger.html

However, a simpler way to enable eventbridge notifications for an S3 bucket exists as a bucket level setting:
https://docs.aws.amazon.com/AmazonS3/latest/userguide/EventBridge.html

However when using `S3Trigger.EVENTS` the generated event pattern is:
```json
{
"detail-type": ["AWS API Call via CloudTrail"],
"source": ["aws.s3"],
"detail": {
"requestParameters": {
"bucketName": [""],
"key": [""]
},
"resources": {
"ARN": [""]
},
"eventName": ["CompleteMultipartUpload", "CopyObject", "PutObject"]
}
}
```

Which does not match with the event generated by the S3 integration.

### Use Case

Allow using event-triggered pipes (which AWS recommends https://docs.aws.amazon.com/codepipeline/latest/userguide/update-change-detection.html#update-change-detection-S3-event) without having to provision a CloudTrail trail.

### Proposed Solution

Another enum value that generates an event pattern similar to the following:

```json
{
"source": [
"aws.s3"
],
"detailType": [
"Object Created",
"Object Restore Completed"
],
"detail": {
"bucket": {
"name": ""
},
"object": {
"key": ""
}
}
}
```

### Other Information

_No response_

### Acknowledgements

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

### CDK version used

2.93.0

### Environment details (OS name and version, etc.)

macOS 13.5.1

Contributor guide

Open the contributing guide

Research direction

Start with the S3Trigger.EVENTS entry point and compare its current event pattern with the proposed S3 integration pattern. Trace how the trigger is represented in CDK Pipelines, then verify that the new option produces the requested bucket and object fields without requiring CloudTrail.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, typescript
Domain
ci-cd, cloud
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.