Bootstrap FreeKB - Amazon Web Services (AWS) - List S3 Bucket Location using the AWS CLI
Amazon Web Services (AWS) - List S3 Bucket Location 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.

~]$ aws s3api list-buckets
{
    "Buckets": [
        {
            "Name": "my-bucket-ozckkxpoon",
            "CreationDate": "2023-06-02T02:22:19+00:00"
        },
        {
            "Name": "my-bucket-uygwfdeyxq",
            "CreationDate": "2023-06-07T01:21:59+00:00"
        }
    ],
    "Owner": {
        "DisplayName": "john.doe",
        "ID": "ab0e0a411234d5103a77c82240d5abcdc41ff11cc325c65b5c777a5123443743"
    }
}

 

The s3api get-bucket-location command can be used to return the location of the S3 Bucket. By default, S3 Buckets reside in the us-east-1 region. S3 Buckets in the us-east-1 region will have LocationConstraint null.

~]$ aws s3api get-bucket-location --bucket my-bucket-ozckkxpoon
{
    "LocationConstraint": null
}

 

On the other hand, S3 Buckets in a region other than us-east-1 will list the region.

~]$ aws s3api get-bucket-location --bucket my-bucket-uygwfdeyxq
{
    "LocationConstraint": "us-east-2"
}

 




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 85050d in the box below so that we can be sure you are a human.