Solution: AWS S3 CLI Command AccessDenied

AWS S3 CLI AccessDenied Error
% aws s3 ls

An error occurred (AccessDenied) when calling the ListBuckets operation: Access Denied

% aws s3 mb s3://mybucket
make_bucket failed: s3://mybucket An error occurred (AccessDenied) when calling the CreateBucket operation: Access Denied

% aws s3 rb s3://mybucket
remove_bucket failed: s3://mybucket An error occurred (AccessDenied) when calling the DeleteBucket operation: Access Denied

There could be multiple reasons for AccessDenied errors when using AWS S3 using CLI, the most common one is that you may not have permissions on a specific region you are trying to access S3.

  • Make use of the region you have access to along with S3 CLI command --region=us-east-1
  • Recongifure your configure your default location in the ~/.aws/config file, or by running aws configure command,
  • Provide access to the region by updating the AWS Policy - check with your Cloud Admin.
Try Out Code2care Dev Tools:


Code2care is an initiative to publish and share varied knowledge in programming and technical areas gathered during day-to-day learnings and development activities.

Students and software developers can leverage this portal to find solutions to their various queries without re-inventing the wheel by referring to our easy to understand posts. Technical posts might include learnings, tutorials, trouble-shooting steps, video tutorials, code snippets, how-to, blogs, articles, etc.

🎉 We are celebrating the 10th years of Code2care! Thank you for all your support!

We strongly support Gender Equality & Diversity.