Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

s3api get-bucket-location returns null for us-east-1 bucket

Don't know why this happens, but getting null for location call

aws --version
aws-cli/1.10.62 Python/2.7.11 Darwin/16.1.0 botocore/1.4.52
aws> s3api get-bucket-location --bucket joshuacalloway-us-east-2-bucket
{
    "LocationConstraint": "us-east-2"
}
aws> s3api get-bucket-location --bucket joshuacalloway-us-east-1-bucket
{
    "LocationConstraint": null
}
like image 596
jcalloway Avatar asked Nov 08 '16 21:11

jcalloway


People also ask

What is the difference between S3 and s3api?

The main difference between the s3 and s3api commands is that the s3 commands are not solely driven by the JSON models. Rather, the s3 commands are built on top of the operations found in the s3api commands. As a result, these commands allow for higher-level features that are not provided by the s3api commands.

What region is my S3 bucket in?

By default it will be in your current location of your AWS. You can change it to the region you want.


1 Answers

us-east-1 is a specific region as discussed in some AWS doc as below:

https://aws.amazon.com/fr/blogs/developer/leveraging-the-s3-and-s3api-commands/

For example, if I make a bucket located in the Frankfurt region using the s3 commands:

$ aws s3 mb s3://myeucentral1bucket --region eu-central-1
make_bucket: s3://myeucentral1bucket/`

I can then use s3api get-bucket-location to determine the region of my newly created bucket:

$ aws s3api get-bucket-location --bucket myeucentral1bucket
{
    "LocationConstraint": "eu-central-1"
}

As shown above, the value of the LocationConstraint member in the output JSON is the expected region of the bucket, eu-central-1. Note that for buckets created in the US Standard region, us-east-1, the value of LocationConstraint will be null. As a quick reference to how location constraints correspond to regions, refer to the AWS Regions and Endpoints Guide.

http://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region

If you use a region other than the US East (N. Virginia) endpoint to create a bucket, you must set the LocationConstraint bucket parameter to the same region

like image 97
Frederic Henri Avatar answered Sep 20 '22 19:09

Frederic Henri