简体   繁体   中英

Trigger Lambda function when S3 buckets get created

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM