`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.
IntermediateTroubleshootingS3, EBS and EFS
Answer
Likely causes → The object is encrypted with SSE-KMS using a customer managed key, and the caller has no kms:Decrypt on that key (through the key policy or IAM). For uploads, the missing permission is kms:GenerateDataKey.
Diagnose →
aws s3api head-object --bucket data --key reports/q3.parquet \
--query '[ServerSideEncryption,SSEKMSKeyId]'
aws kms get-key-policy --key-id <key-arn> --policy-name default --output text
# CloudTrail: look for kms Decrypt with errorCode AccessDenied
Fix →
- Grant
kms:Decrypton the key ARN to the role in IAM, and make sure the key policy allows IAM policies (the root principal statement) or names the role - For cross-account access, both the key policy and the caller's IAM policy must allow it
Prevent → Every S3 access policy template includes the matching KMS statement, and S3 Bucket Keys are on to reduce KMS calls.
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.IntermediateAn S3 static website endpoint returns `403 Forbidden` with `Code: AccessDenied`.IntermediateHigh-throughput writes get `503 SlowDown: Please reduce your request rate.`Intermediate`BucketNotEmpty: The bucket you tried to delete is not empty. You must delete all versions in the bucket.` even after `aws s3 rm --recursive`.Beginner