- 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,