Identifiers
AWS S3 Bucket Name
Validate AWS S3 bucket names per the standard naming rules: 3–63 chars, lowercase, alphanumeric + dots + hyphens.
Try it in RegexPro →Available in
Pattern
regexengine-agnostic
^[a-z0-9](?:[a-z0-9.\-]{1,61}[a-z0-9])?$Raw source: ^[a-z0-9](?:[a-z0-9.\-]{1,61}[a-z0-9])?$
How it works
First and last char must be lowercase alphanumeric. Middle can contain dots and hyphens too. Length is 3–63 chars total. This is the STRUCTURAL rule — S3 also forbids names that look like IPs and a few other edge cases the regex doesn't catch.
Examples
Input
my-app-uploadsMatches
my-app-uploads
Input
logs.example.comMatches
logs.example.com
Input
Invalid_NameNo match
—Common use cases
- •Terraform / CloudFormation validation
- •S3 bucket auto-provisioning workflows
- •Multi-tenant naming convention enforcement
- •Migration tooling between regions / accounts