handsome
handsome

Reputation: 2422

Make domain point to a directory in S3

I have 2 domains and I would like to route them to different directories in the same S3 bucket

domain1.com > s3-bucket/domain1
domain2.com > s3-bucket/domain2

is this possible? I couldn't find anything.

do I need to route all oF them to a single location (like a lambda function) and somehow redirect to a bucket directory?

Upvotes: 0

Views: 316

Answers (2)

duyvh
duyvh

Reputation: 494

You will need Cloudfront to do what you want.

  • You need to create 2 Cloudfront distributions, 1 for each domain you have.
  • Configure each distribution with the same s3 bucket as the origin. In the origin path, put /domain1 and /domain2 for the 2 distributions.
  • Set Alternate Domain Names as domain1.com and domain2.com respectively
  • Provision DNS records to CNAME to the cloudfront's URL (xyz.cloudfront.net)

Upvotes: 2

John Rotenstein
John Rotenstein

Reputation: 270144

This is not possible.

DNS names resolve to an IP address. There is no way to indicate a Folder via a domain name.

Also, Amazon S3 requires that Bucket names match the Domain name. See: Configuring a static website using a custom domain registered with Route 53 - Amazon Simple Storage Service

Upvotes: 1

Related Questions