Reputation: 11
I deployed an SMB file gateway on AWS for a customer, but it is not synchronizing with the S3 bucket. I would like to trigger a Lambda function using CloudWatch Events everytime there is a change in the bucket (PUT or DELETE) and invoke a RefreshCache function with that Lambda function. Examples are very complicated and I feel so helpless. Please help! Any examples with explanation is fine. Thank you.
Upvotes: 0
Views: 201
Reputation: 200617
I don't think using CloudWatch Events for this is the correct approach. You should simply configure the S3 bucket to directly trigger a Lambda function on any new object events, or object delete events.
When you have this configured, the S3 bucket will send events to the Lambda function in the format documented here.
Inside the Lambda function you would iterate over the Records
in that event message, using the object key
value in each record as the path that needs to be refreshed in the cache.
Upvotes: 1