I am trying to create lambda with s3 event trigger with below stack. i want to trigger the lambda when object are placed in two directory with in same s3
MyBucket:
Type: AWS::S3::Bucket
Properties:
BucketName: !Ref S3
LambdaS3: # Name change -change fun name
Type: AWS::Serverless::Function
Properties:
Handler: lambda_function.lambda_handler
Runtime: python3.7
Timeout: 60
FunctionName: !Sub "${Environment}somefun"
CodeUri: ./mysource/src
Role: !GetAtt myiam.Arn
Description: "Test"
Environment:
Variables:
KINESIS_STREAM: !Sub "${Environment}_my_kinesis"
ENVIRONMENT: !Sub "${Environment}"
Events:
FileUpload:
Type: S3
Properties:
Bucket: !Ref MyBucket
Events: s3:ObjectCreated:*
Filter:
S3Key:
Rules:
- Name: prefix
Value: "L1/Test_1/INPUT/"
- Name: suffix
Value: ".json"
- Name: prefix
Value: "L2/Test_2/INPUT/"
- Name: suffix
Value: ".json"
Now here iam refering two s3 location for the event trigger
L1/Test_1/INPUT/ and L2/Test_2/INPUT/
but after i deployed the code, i am getting below error:
Following Resources Failed to create[MyBucket]. Property rules contains duplicate value
Can anyone help on this?