Bootstrap FreeKB - Amazon Web Services (AWS) - List S3 Buckets using the AWS CLI
Amazon Web Services (AWS) - List S3 Buckets using the AWS CLI


This assumes you have already configured the aws command line tool. If not, check out my article on Getting Started with the AWS CLI.

An S3 Bucket is similar to an NFS share in that it is a mountable storage volume.

The aws s3api list-buckets command can be used to list your S3 buckets. The profile being used when issing the command must have the ListBuckets permission. Check out my article Amazon Web Services (AWS) - List IAM User Policies using the AWS CLI.

~]$ aws s3api list-buckets
{
    "Buckets": [
        {
            "Name": "my-bucket-abcdefg",
            "CreationDate": "2023-06-02T02:22:19+00:00"
        }
    ],
    "Owner": {
        "DisplayName": "john.doe",
        "ID": "ab0e0a41234567893a77c82240d5abcdc41ff11c123456789c777a5123443743"
    }
}

 

And here is an example of how to limit the output using the --query option.

aws s3api list-buckets --query 'Buckets[?Name==`my-bucket`]'

 

If you have an S3 URL, the --endpoint-url option can be used to specify your S3 URL.

aws s3api list-buckets --endpoint-url "https://s3.example.com:12345" --profile john.doe

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter 2b1bc2 in the box below so that we can be sure you are a human.