Fix AWS S3 Access Denied in India: Step-by-Step
In this article
If you're getting an "Access Denied" error when trying to access an S3 bucket from AWS in India, it usually means a permission or configuration mismatch. This guide walks you through the most common causes and fixes, from IAM policies to bucket policies, and includes region-specific considerations like the Asia Pacific (Mumbai) endpoint.
What You'll Need
- AWS Management Console access with permissions to view IAM and S3
- The exact name of the bucket you're trying to access
- The AWS region where the bucket is hosted (e.g., ap-south-1 for Mumbai)
- The IAM user/role ARN or the access key ID you're using
- If using CLI, the AWS CLI installed and configured
Step-by-Step
- Check the error message details. In the AWS Console or CLI output, look for the exact error code (e.g.,
AccessDenied,403,SignatureDoesNotMatch). Note the resource ARN and the action that failed. This tells you whether it's an IAM, bucket policy, or network issue. - Verify your IAM identity. Go to the IAM console, find the user/role you're using, and confirm it has the necessary S3 permissions. At minimum, you need
s3:GetObject(for reads) ands3:PutObject(for writes). If you're using an access key, ensure it's active. - Attach a managed policy if needed. If your IAM user lacks S3 permissions, attach the AWS managed policy
AmazonS3ReadOnlyAccessorAmazonS3FullAccesstemporarily to test. If that fixes it, you need to refine your custom policy. - Check the bucket policy. In the S3 console, select your bucket, go to the Permissions tab, and review the bucket policy. Ensure it allows the specific principal (your IAM user/role) to perform the action on the bucket and objects. Look for any
Denystatements that might override an allow. - Check the bucket ACL (if enabled). If the bucket has public access blocked, but you're using an IAM user, ACLs are not the issue. However, if you're using an unauthenticated request (like a public URL), check the ACL and the bucket's public access settings.
- Verify the region endpoint. If you're using the CLI or SDK, ensure you're hitting the correct regional endpoint for India. For Mumbai, use
s3.ap-south-1.amazonaws.com. Using the global endpoint (s3.amazonaws.com) can cause redirects and permission errors if the bucket is region-specific. - Check for encryption conflicts. If the bucket uses SSE-KMS (KMS encryption), the IAM user must have
kms:Decryptpermission on the KMS key. Without it, you'll get an Access Denied even if S3 permissions are correct. - Test with a simple CLI command. Run
aws s3 ls s3://your-bucket-name --region ap-south-1to see if listing works. If it fails, the error will point you to the specific permission missing. - Check for public access block. If you're trying to access the bucket anonymously (e.g., via a static website URL), ensure the bucket's public access block is not set to block all public access. You can adjust this in the Permissions tab.
- Review CloudTrail (if enabled). For a deeper look, check CloudTrail logs for the exact request and the reason for denial. This is especially useful if you have multiple policies.
Common Mistakes
- Using the wrong region. Accessing a bucket in ap-south-1 from a us-east-1 CLI profile can cause a redirect and a permission error. Always specify the region.
- Forgetting KMS permissions. If the bucket is encrypted with KMS, you need both S3 and KMS permissions. Many users only add S3 permissions and wonder why it fails.
- Overly restrictive bucket policies. A bucket policy that allows only specific IPs or VPC endpoints will deny access from your current IP. Check for
aws:SourceIpconditions. - Assuming IAM permissions are enough. If the bucket policy has an explicit Deny, it overrides any IAM allow. Always check both.
- Using the wrong account ID. If you're trying to access a bucket in another AWS account, the bucket policy must explicitly allow your IAM user ARN.
Tips
- Use the Policy Generator in the AWS console to create a bucket policy that matches your exact use case.
- For IAM policies, use the visual editor to add S3 actions and resources. It helps avoid syntax errors.
- If you're using the CLI, add
--debugto see the exact request and response headers. This can reveal if the error is a signature issue. - Test with a simple object first. Upload a test file and try to download it via the CLI to isolate the issue.
- For production, use IAM roles instead of long-term access keys, especially for EC2 instances.
Troubleshooting
If you still get Access Denied after checking IAM and bucket policies:
- Check for S3 Object Ownership. If the bucket was created by another account, the object may be owned by that account, and your account may not have permission to read it even with bucket-level permissions. Use
s3:GetObjectAclto check. - Check for a bucket-level Block Public Access. If you're trying to make objects public, go to the bucket's Permissions tab and ensure Block Public Access is not set to block all public access. You may need to edit the settings.
- Verify the object key. If you're accessing a specific object, ensure the key (path) is correct. A typo can cause a 403 if the bucket policy restricts access to a prefix.
- Check for VPC endpoint restrictions. If you're accessing S3 from a VPC, the bucket policy may have a condition that only allows requests from a specific VPC endpoint. If you're not using that endpoint, you'll be denied.
- Clear your DNS cache. Sometimes, a stale DNS entry can point to the wrong S3 endpoint. Flush your DNS and retry.
- Wait for IAM propagation. IAM changes can take a few seconds to propagate. If you just changed a policy, wait a minute and retry.
Frequently Asked Questions
Why do I get Access Denied even though I'm the root user?
Even the root user can be denied if the bucket policy has an explicit Deny or if the bucket is in a different account. Also, if the bucket is encrypted with a KMS key that you don't have access to, you'll be denied.
How do I fix Access Denied when using AWS CLI in India?
Ensure you specify the region with --region ap-south-1. Also, check that your IAM user has the required S3 and KMS permissions. Run aws sts get-caller-identity to verify you're using the correct credentials.
What does 'Access Denied' mean when I try to set a bucket policy?
You need s3:PutBucketPolicy permission on the bucket. If you're not the bucket owner, the owner must grant you that permission. Also, check that you're not trying to set a policy that conflicts with the bucket's Block Public Access settings.
Can a bucket in Mumbai be accessed from the global endpoint?
Yes, but AWS may redirect to the regional endpoint. If your IAM policy is region-specific or your client doesn't handle redirects properly, you may get an Access Denied. It's best to use the regional endpoint directly.
Why does my S3 static website return 403 Forbidden?
Your bucket must have public read access to objects. Check the bucket policy to allow s3:GetObject for Principal: "*". Also, ensure the bucket's public access block is not set to block all public access.
How do I grant access to a specific IAM user from another account?
In the bucket policy, set the Principal to the IAM user ARN (e.g., arn:aws:iam::123456789012:user/username). Also, ensure that user's IAM policy allows the S3 action on that bucket.