0
votes

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

1 Answers

2
votes

You can use Cloudwatch event here.

  1. Go to cloudwatch and under events, select rule.
  2. Create a new rule.
  3. Select Event Pattern, specific operations, and then select CreateBucket.
  4. 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.