Configure Event Rule Payload as parametrised bucket
I am defining BucketName which will take user input as a list of bucket separated by ",". I want to use these buckets in the request parameters section of EventRule
Description: Template to create AWS Event Bridge
Parameters:
BucketName:
Type: String
Default: "Enter Bucket Name1,BucketName2"
Resources:
EventRule:
Type: AWS::Events::Rule
Properties:
Description: "EventRule"
State: "ENABLED"
EventPattern:
source:
- aws.s3
detail:
eventSource:
- "s3.amazonaws.com"
eventName:
- PutObject
- DeleteObject
requestParameters:
bucketName:
- Fun::Split: [",", !Ref BucketName]
But it is throwing following error message
Event pattern is not valid. Reason: Unrecognized match type Fun::Split at [Source: (String)"{"source":["aws.s3"],"detail":{"eventSource":["s3.amazonaws.com"],"requestParameters":{"bucketName":[{"Fun::Split":[",",""abc,def""]}]},"eventName":["PutObject","DeleteObject"]}}"; line: 1, column: 117] (Service: AmazonCloudWatchEvents; Status Code: 400; Error Code: InvalidEventPatternException; Request ID: d80f531a-660d-4f4c-b9ab-70cb4507bf05; Proxy: null)
It should be Fn::Split
m not Fun::Split
.