AWS S3 Bucket Log Management | Troubleshooting and Data Retention

Manage Logs in AWS S3 Buckets

Question

Development teams in your organization use S3 buckets to store the log files for various applications hosted in development environments in AWS.

The developers want to keep the logs for one month for troubleshooting purposes and then remove the logs. What feature will enable this requirement?

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D.

Answer: B.

Option A is incorrect because adding bucket policies cannot control the deletion of logs.

Option B is CORRECT because Lifecycle configuration enables you to specify the lifecycle management of objects in a bucket, logs in this case.

We can use expiration actions - In which you specify when the objects expire.

Then Amazon S3 deletes the expired objects on your behalf.

Option C is incorrect because creating an IAM policy cannot control the deletion of logs.

Option D is incorrect because CORS is used for accessing objects across domains and not for the deletion of logs.

For more information on AWS S3 Lifecycle policies, kindly refer to the following URL:

https://docs.aws.amazon.com/AmazonS3/latest/dev/object-lifecycle-mgmt.html

The correct answer is B. Configuring lifecycle configuration rules on the S3 bucket.

Explanation:

Amazon S3 provides a feature called Lifecycle configuration, which allows you to define rules that automate the management of objects in your bucket over their lifetime. You can use lifecycle configuration to transition objects to different storage classes, delete objects, or archive objects to Amazon S3 Glacier based on the object age or other object metadata.

In this scenario, the requirement is to keep log files for one month only, which means these files are no longer required after one month. In such a case, we can use lifecycle configuration rules to automate the deletion of log files that are older than one month.

To configure lifecycle configuration on an S3 bucket, you need to create rules that define the following actions:

  1. Transitions: You can define a rule to transition objects to a different storage class after a certain period. For example, you can transition log files from the S3 Standard storage class to S3 Glacier storage class after one month.

  2. Expiration: You can define a rule to delete objects after a certain period. For example, you can delete log files that are older than one month.

Therefore, by configuring a lifecycle configuration rule to delete log files that are older than one month, the development team can ensure that the logs are retained for the required time and then automatically deleted, without requiring any manual intervention.

Hence, the correct answer is B. Configuring lifecycle configuration rules on the S3 bucket.