I have an S3 Resource on which I put and remove objects. Those operations are client-side operations meaning that there is no lambda function involve in those actions. The backend was created using serverless.
Here is the S3 resource under resource key in serverless.yml
resources:
Resources:
AttachmentsBucket:
Type: AWS::S3::Bucket
Properties:
BucketName: ${self:provider.environment.PROJECTS_S3_BUCKET}
CorsConfiguration:
CorsRules:
- AllowedOrigins:
- '*'
AllowedHeaders:
- '*'
AllowedMethods:
- GET
- PUT
- POST
- DELETE
- HEAD
MaxAge: 3000
BucketPolicy:
Type: AWS::S3::BucketPolicy
Properties:
Bucket: !Ref AttachmentsBucket
PolicyDocument:
Id: MyPolicy
Version: "2012-10-17"
Statement:
- Sid: PublicReadWriteBucketPolicy
Effect: Allow
Principal: '*'
Action:
- 's3:GetObject'
- 's3:PutObject'
Resource: 'arn:aws:s3:::${self:provider.environment.PROJECTS_S3_BUCKET}/*'
I need to log Amazon S3 Object-Level operation using CloudWatch events (PUT and DELETE objects) so I can later use those logs (as a source for a Step function)
Could someone please let me know how to log Amazon S3 Object-Level operation using CloudWatch events in Serverless Framework?
BR