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]#"
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.