A security engineer is troubleshooting an issue where an EC2 instance cannot access an S3 bucket via a VPC endpoint. The bucket policy allows access only from the VPC endpoint. The instance has an IAM role that grants s3:GetObject on the bucket. The EC2 instance receives an AccessDenied error. What is the most likely cause?
Trap 1: The IAM role does not have sufficient permissions.
The role grants s3:GetObject, so permissions should be sufficient from IAM side.
Trap 2: The VPC endpoint policy is blocking the request.
Endpoint policy could block, but the problem statement says bucket policy allows only from VPC endpoint; the endpoint policy might not be the issue.
Trap 3: The EC2 instance's security group does not allow outbound traffic…
Security group would cause a timeout, not an AccessDenied error from S3.
- A
The IAM role does not have sufficient permissions.
Why wrong: The role grants s3:GetObject, so permissions should be sufficient from IAM side.
- B
The bucket policy does not include the aws:SourceVpce condition.
Without this condition, the bucket policy that restricts to VPC endpoint may not match the request, causing AccessDenied.
- C
The VPC endpoint policy is blocking the request.
Why wrong: Endpoint policy could block, but the problem statement says bucket policy allows only from VPC endpoint; the endpoint policy might not be the issue.
- D
The EC2 instance's security group does not allow outbound traffic to S3.
Why wrong: Security group would cause a timeout, not an AccessDenied error from S3.