Quantcast
Viewing all articles
Browse latest Browse all 73

Using two aws cloudfront origins to the same S3 bucket?

Is it possible to have a single Cloudfront distribution with two origins that refer to different folders on the same S3 bucket?

I have a simple/small project and to avoid clutter my stack with multiple buckets I'd like to use a single one and have different contents in subfolders, e.g. to use different cache behaviors or serving a single page application from a subfolder and user generated content from the other.

But it seems I cannot use the same resource id as an origin id more than once:

Resource handler returned message: "Invalid request provided: AWS::CloudFront::Distribution: The parameter origin ID must be unique. (Service: CloudFront, Status Code: 400, Request ID: c0309ded-d a7c-41cf-9efa-3a850856 d075)" (RequestToken: be62d662-15ea-d3d4-1a76-8780f4dda3bb, HandlerErrorCode: InvalidRequest)

Moreover

As a quick workaround I used a second bucket, but this time I get an error about having different origins with the same path:

Resource handler returned message: "Invalid request provided: AWS::CloudFront::Distribution: The parameter path pattern must be unique. (Service: CloudFront, Status Code: 400, Request ID: b028a107-1 4be-4f74-a976-f8ecfb58 410e)" (RequestToken: cfa0df4d-5bf6-aceb-7f95-32995ed1d9ea, HandlerErrorCode: InvalidRequest)

So as a workaround for the workaround I ended setting different buckets and different folders, but it seems so stupid.


Viewing all articles
Browse latest Browse all 73

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>