Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

My application uses all 3 service layers. Recent feature request to lower the outgoing traffic gives us some uncertainties.

Say, we have a requirement to distribute the image.jpg file with CloudFront. It's all good while there's no dynamic image resizing. Now that we don't need the original size of the image all the time we pass desired variable dimension along with the query string (image.jpg?w=100&h=100).

If we would have routed CF to EC2 directly, then there would not be any problems at all. But, we should have the S3 in between, since EC2 is too small to store media materials.

So the question is - how do you push inexistent file to S3 during the request?

Thanks.

share|improve this question

1 Answer 1

I don't think you need (or would want) to reroute the request after getting a 404 from the S3 bucket. You'd then be making two requests sequentially and slowing things down.

CloudFront does supports multiple origin servers. Don't think of it as S3 between CloudFront and EC2, but S3 next to EC2. Take a look here:

Origin Servers

You can configure one or more origin servers for your Amazon CloudFront download distribution. Origin servers can be an AWS resource, such as Amazon S3, Amazon EC2, Elastic Load Balancing, or a custom origin server outside of AWS. Amazon CloudFront will request content from each origin server by matching the URLs requested by the viewer with rules you configure for your distribution. This feature allows you the flexibility to use each AWS resource for what it’s designed for – Amazon S3 for storage, Amazon EC2 for compute, etc. – without the need to create multiple distributions and manage multiple domain names on your website. You can also continue to use origin servers you already have set-up without the need to move data or re-deploy your application code.

There's also a nice blog post about setting up multiple origins here.

share|improve this answer
1  
This is awesome! How come we've missed this?! Anyway, will give it a go and tell you the outcome. –  Aleksandr Makov Feb 20 at 19:19
    
@AleksandrMakov Took me a bit to find anything on it actually. It doesn't seem to be outlined in the docs. If you stumble upon anything more detailed, please let me know! –  Tanner Feb 20 at 20:22

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.