S3 create-bucket: us-east-1 vs other regions
📑 On this page
Part 12 of AWS from Zero. Today we slow down on one odd S3 detail: creating a bucket in us-east-1 is different from creating a bucket in most other regions.
This is one of those small AWS details that causes a lot of beginner confusion.
What we are learning
For a general purpose S3 bucket:
- If you create it in
us-east-1, you do not passLocationConstraint. - If you create it in another region, you normally pass
LocationConstraint.
Same service, same operation, slightly different command.
Before you run it
Check identity:
aws sts get-caller-identityChoose two unique bucket names:
EAST_BUCKET="aws-zero-east-12345"
SOUTH_BUCKET="aws-zero-south-12345"Replace the suffix so the names are unique for you.
Create a bucket in us-east-1
aws s3api create-bucket \
--bucket "$EAST_BUCKET" \
--region us-east-1Notice what is missing: no --create-bucket-configuration.
Inspect the location:
aws s3api get-bucket-location \
--bucket "$EAST_BUCKET" \
--output tableFor us-east-1, S3 may return None or an empty-looking location value. That is normal historical S3 behavior.
Create a bucket in ap-south-1
aws s3api create-bucket \
--bucket "$SOUTH_BUCKET" \
--region ap-south-1 \
--create-bucket-configuration LocationConstraint=ap-south-1Inspect the location:
aws s3api get-bucket-location \
--bucket "$SOUTH_BUCKET" \
--output tableThis one should show ap-south-1.
One tiny variation
Try asking for help and search for LocationConstraint:
aws s3api create-bucket helpThe help page is often faster than searching the web when you only need the shape of a command.
Common mistake
Beginners often use the non-us-east-1 command everywhere:
aws s3api create-bucket \
--bucket "$EAST_BUCKET" \
--region us-east-1 \
--create-bucket-configuration LocationConstraint=us-east-1That is the mistake. For us-east-1, keep the create command simpler.
Cleanup
Both buckets are empty, so delete them directly:
aws s3api delete-bucket --bucket "$EAST_BUCKET" --region us-east-1
aws s3api delete-bucket --bucket "$SOUTH_BUCKET" --region ap-south-1Confirm:
aws s3api list-buckets \
--query "Buckets[?Name=='$EAST_BUCKET' || Name=='$SOUTH_BUCKET']"Next, we will compare aws s3 and aws s3api so the command families stop feeling random.