How to enable logging for an S3 bucket?

To enable logging for an S3 bucket, follow these steps:

  1. Sign in to the AWS Management Console.

  2. Open the Amazon S3 console.

  3. In the bucket list, select the bucket for which you want to enable logging.

  4. Click on the "Properties" tab.

  5. Scroll down to the "Server access logging" section and click on the "Edit" button.

  6. Check the box next to "Enable logging."

  7. Select the target bucket where you want log files to be stored.

  8. Enter a prefix for log file names, if desired.

  9. Click on the "Save" button to enable logging for the bucket.

Once logging is enabled, access logs for the bucket will be stored in the target bucket you specified. You can then view and analyze these logs to track the access and usage of your S3 bucket.