I want to create a Lambda function using Java or Python so that whenever a new S3 bucket gets created, by default it enables default encryption of AES256 and server-access logs on those buckets, if they were not enabled while creating the bucket.
1 Answers
2
votes
You can use Cloudwatch event here.
- Go to cloudwatch and under events, select rule.
- Create a new rule.
- Select Event Pattern, specific operations, and then select CreateBucket.
- Now in the next column you can click add target and select the lambda you want to trigger. (create one if you don't already have it)
Now write your lambda using Java and use the SDK to make whatever changes you require.