Bri
Bri

Reputation: 396

Cloudformation - Lambda Trigger on S3 Event? (Bucket Already Exists)

Is there a way to add a trigger to a Lambda function in Cloudformation for s3 events, where the s3 bucket already exists? (i.e, is not created by said template)

I have tried to find an example of this online, but it appears that the only way to set this trigger in CF is by using the bucket notification configuration.

Upvotes: 2

Views: 1157

Answers (1)

Istvan
Istvan

Reputation: 8572

Cloudformation cannot do this directly. However, Cloudformation Custom Resources can call Lambda functions, and Lambda functions can do whatever you program them to do. You could write a Lambda function which creates or deletes some resource based on whatever logic you want.

See more: AWS Lambda-backed Custom Resources - AWS CloudFormation

Upvotes: 2

Related Questions