I am trying to write a cloudformation template which involves adding an event to a bucket to trigger a lambda function.
I know i can use code such as the below to create a bucket and an event at the same time but my bucket already exists and i don't want another one so is there a way of creating an event for an existing bucket within cloud formation?
"EncryptionServiceBucket" : {
"Type" : "AWS::S3::Bucket",
"Properties" : {
"BucketName" : { "Fn::Sub" : "${User}-encryption-service" },
"NotificationConfiguration" : {
"LambdaConfigurations" : [{
"Function" : { "Ref" : "LambdaDeploymentArn" },
"Event" : "s3:ObjectCreated:*",
"Filter" : {
"S3Key" : {
"Rules" : [{
"Name" : "suffix",
"Value" : "zip"
}]
}
}
}]
}
}
}