Tag vulnerable Amazon ECR images

Amazon Inspector Scan finding → Amazon EventBridge Rule → AWS Step Functions Workflow → Amazon SNS Notification → Amazon ECR Image tag

An Amazon Inspector finding on a vulnerable Amazon ECR image triggers an AWS Step Functions workflow via Amazon EventBridge to tag the image and alert via Amazon SNS.

This pattern tags a vulnerable container image as soon as Amazon Inspector raises a HIGH or CRITICAL finding on it. The tag is a marker only: it doesn't stop anyone pulling or deploying the image.
An Amazon Inspector finding on an Amazon ECR container image is routed by an Amazon EventBridge rule (source aws.inspector2, detail-type Inspector2 Finding, filtered to ACTIVE HIGH/CRITICAL findings on images in the demo repository) to an AWS Step Functions STANDARD workflow.
The workflow reads the image manifest by digest with ecr:BatchGetImage and writes the same manifest back under a per-image quarantine-<digest> tag with ecr:PutImage - a pure control-plane re-tag that needs no AWS Lambda function - then publishes an Amazon SNS notification. Retry and Catch drive a failure-notification path, and repeat findings for an already tagged image end without another email.

< Back to all patterns

GitHub icon Download this pattern (.zip)

GitHub icon View this pattern on GitHub


Clone repo

git clone https://github.com/aws-samples/serverless-patterns/cd serverless-patterns/inspector-eventbridge-sfn/typescript/cdk

Deploy

cd serverless-patterns/inspector-eventbridge-sfn/typescript/cdknpm installIf this account and Region have never been used with the AWS CDK, run npx cdk bootstrap oncenpx cdk deploy


Testing

See the GitHub repo for detailed testing instructions.

Cleanup

Delete the stack: npx cdk destroy.

Created by:

Nithin Chandran R

Nithin Chandran R

Technical Account Manager at AWS