# File lib/aws/s3/client.rb, line 1551 def dns_compatible_bucket_name?(bucket_name) return false if !valid_bucket_name?(bucket_name) or # Bucket names should be between 3 and 63 characters long bucket_name.size > 63 or # Bucket names must only contain lowercase letters, numbers, dots, and dashes # and must start and end with a lowercase letter or a number bucket_name !~ /^[a-z0-9][a-z0-9.-]+[a-z0-9]$/ or # Bucket names should not be formatted like an IP address (e.g., 192.168.5.4) bucket_name =~ /(\d+\.){3}\d+/ or # Bucket names cannot contain two, adjacent periods bucket_name['..'] or # Bucket names cannot contain dashes next to periods # (e.g., "my-.bucket.com" and "my.-bucket" are invalid) (bucket_name['-.'] || bucket_name['.-']) true end