Understand Bucket Naming Rules

Learn about the naming conventions for the S3 bucket.

Before we dive into hands-on learning with S3, we need to know some basic naming rules to follow while creating an S3 bucket.

We already discussed in a previous lesson that bucket names must be globally unique and DNS compliant. Let’s see what these rules are in detail.

Bucket naming rules

  • The bucket name must be globally unique across AWS.
  • The name must be 3–63 characters long.
  • The name can consist only of lowercase letters, numbers, dots (.), and hyphens (-).
  • The name must begin and end with a letter or number.
  • The name must not be formatted as an IP address, like 192.54.54.101.
  • The name must not start with the prefix “xn–.”

It’s recommended to use the dot (.) in a bucket name only if the bucket is supposed to be used for static web hosting.

After bucket creation, the bucket name can’t be changed. So, we have to make sure to give it a name as per our requirements.

Valid bucket names

  • my-s3-bucket
  • test-bucket-dev
  • devbucket1

Invalid bucket names

  • testBucket
  • dev-test.
  • my_s3_bucket

Get hands-on with 1400+ tech skills courses.