Interview Prep/AWS/S3, EBS and EFS

Someone added a bucket policy with `"Effect":"Deny"` unless `aws:SourceVpce` matches. Now even admins get `AccessDenied`, including on `PutBucketPolicy`.

AdvancedTroubleshootingS3, EBS and EFS
Answer

Likely causes → An explicit deny in the bucket policy beats every allow, including admin IAM policies. Calls from outside the VPC endpoint (console, laptop CLI) are denied, and that includes changing the policy.

Diagnose →

aws s3api get-bucket-policy --bucket locked --output text   # likely denied too
# CloudTrail: GetBucketPolicy / PutBucketPolicy errorCode AccessDenied

Fix →

  1. Call from a principal that matches the condition, for example an instance in the VPC that uses that endpoint, and run aws s3api delete-bucket-policy --bucket locked
  2. If nothing can match, sign in as the account root user, which can always delete a bucket policy that locks it out (with Organizations, the management account can use centralized root access for member accounts)

Prevent → Always exempt a break-glass role in deny conditions (aws:PrincipalArn with StringNotLike), and test policies with Access Analyzer policy validation before applying them.

aws All AWS questions Roadmap: AWS core services

More on S3, EBS and EFS