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 →
- 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 - 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.
More on S3, EBS and EFS
`BucketAlreadyExists: The requested bucket name is not available. The bucket namespace is shared by all users of the system.`Beginner`PermanentRedirect: The bucket you are attempting to access must be addressed using the specified endpoint.`BeginnerA partner account uploads objects into your bucket, but your own admins get `403 Forbidden` reading them.Intermediate`aws s3 cp` gets `An error occurred (AccessDenied) when calling the GetObject operation` but the IAM policy allows `s3:GetObject` and the bucket policy is fine.IntermediateAn S3 static website endpoint returns `403 Forbidden` with `Code: AccessDenied`.IntermediateHigh-throughput writes get `503 SlowDown: Please reduce your request rate.`Intermediate