SAA-C03 Question 70
Single answerA company is hosting a web application on Amazon EC2 instances behind an Application Load Balancer (ALB). The application stores user-uploaded images in an Amazon S3 bucket. Recently, the company noticed that some images are missing or being overwritten when users upload files with the same name. How can the company prevent this issue while still allowing users to upload images?
- A
Configure the S3 bucket to use versioning.
- B
Enable server-side encryption for the S3 bucket.
- C
Add a timestamp or unique identifier to the image file names before storing them in the S3 bucket.
- D
Set up an Amazon S3 Lifecycle policy to archive older versions of the files.
Show answer and explanation
Correct answer: C
Explanation
The root cause of the issue is that files with the same name are being overwritten in the S3 bucket. Adding a timestamp or unique identifier to the file names ensures uniqueness and prevents overwrites. While S3 versioning can retain older versions of files, it does not stop overwrites from occurring, and other options like encryption or Lifecycle policies do not directly address the problem of naming conflicts.
- A. Incorrect.
Enabling versioning in the S3 bucket would allow older versions of files to be retained when overwritten, but it does not prevent overwriting or directly address the root cause of file conflicts due to identical names.
- B. Incorrect.
Server-side encryption ensures data is stored securely in the S3 bucket but does not prevent file overwrites caused by naming conflicts.
- C. Correct.
Adding a timestamp or unique identifier to image file names ensures that every file has a unique name, preventing overwrites or conflicts when multiple users upload files with the same name. This is a direct solution to the problem.
- D. Incorrect.
An S3 Lifecycle policy manages the lifecycle of objects, such as transitioning or deleting files based on age, but it does not address the issue of file overwrites or naming conflicts.