1
  • I have example.com served from idxxxx.cloudfront.net, this goes to S3 bucket nr 1. This works well.
  • I now need subdomain.example.com to also be served from same cloudfront distribution, and point to S3 bucket nr 2. It's a completely different static website hosted on this bucket.

What I tried: I edited origins for my idxxxx.cloudfront.net distribution - I added a new origin there, to point to S3 bucket nr 2, then in Route53 I added this new recordset: Name: subdomain.example.com Type: A - IPv4 Address Alias: yes Alias target: idxxxx.cloudfront.net

The outcome of this attempt: calling subdomain.example.com shows me the contents of S3 bucket nr1 when my intention was to show the content of S3 bucket nr 2 on this subdomain. Is this because for my use case I actually must create another CF distribution? Or can I somehow work with the same distribution?

Maybe useful info - my CF distribution is configured for these CNAMEs: example.com, *.example.com

I also tried adding in Route53 the IPv4 alias that points directly to the S3 bucket nr 2 for subdomain.example.com, and while it works to show me the desired contents of bucket 2, its not retrieved through cloudfront as I actually want it, therefore I dont benefit from things like https and such.

Is my use case impossible with just one CF distribution? Many thanks in advance. Best regards,

4
  • 1
    I'm posting the answer for the question you've asked... but in case I am missing something, I'll also ask: what is your motivation for using 1 (free) distribution instead of 2 (free) distributions? Aug 10, 2017 at 2:32
  • @Michael-sqlbot because of the cost for having two separate CF distributions :) I thought I could try to use one distribution for both. Please tell me what do you mean by (free) distributions? As I understood, each CF distribution is billed separately.
    – Amc_rtty
    Aug 10, 2017 at 9:05
  • 1
    There isn't a charge for a CloudFront distribution -- an actual CloudFront distribution itself has no associated cost. You pay a charge per request handled by CloudFront, and a charge per gigabyte of traffic. aws.amazon.com/cloudfront/pricing Aug 10, 2017 at 11:32
  • Yes but the ACLs are a cost per cloudfront, so multiple cloudfronts are a multiplier effect Jun 22, 2023 at 0:09

1 Answer 1

1

It's a completely different static website

A completely different web site needs a completely separate CloudFront distribution. Identical sites with multiple domain names would be the case where you'd serve multiple sites and associate multiple hostnames from a single distribution.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .