AWS Certified Solutions Architect - Associate (SAA-C02)

Sign Up Free or Log In to participate!

Listing Buckets in aws CLI

I am trying to list S3 buckets in the AWS CLI & I kept getting error issues. What could be causing this error message. "An error occurred (AccessDenied) when calling the ListBuckets operation: Access Denied [root@ip-172-31-28-234 ec2-user]#"

3 Answers


It seems that you are launching the command from an EC2 instance which doesn’t have access to your bucket. I advice you to create an instance profile with the s3:ListBucket api permission and you will be able to see all your buckets.

Try to create a role with s3 full access, attach the instance profile to the ec2 and then run the command again

Please make sure to update the region to us-east-1(North Virginia) inside aws credential file if its pointed to some other region.

Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!

Get Started
Who’s going to be learning?