A data engineer notices that an Amazon S3 bucket policy is overly permissive. What is the best practice to restrict access while maintaining required permissions?
Writing a new bucket policy that denies all actions directly restricts the overly permissive bucket policy. While this may be too restrictive initially, it is the only option that modifies the bucket policy to immediately stop the over-permissive access. You can then add specific allows to maintain required permissions.
Why this answer
The bucket policy is overly permissive, so writing a new bucket policy that denies all actions immediately restricts all access. While this may temporarily block required permissions, it is the most direct way to address the bucket policy issue; you can then refine the policy to allow only necessary actions. Option D does not change the bucket policy and thus does not resolve the problem.
Option A makes permissions even more permissive. Option C is not a standard AWS feature.
Exam trap
Do not confuse IAM policies with bucket policies. Attaching an IAM policy to a user does not override an overly permissive bucket policy; both must be considered together.