Reputation: 381
I am trying to set up an architecture in the Amazon Cloud that will enable me to have my dynamic php files hosted on Elastic Beanstalk and my static files and video content hosted on Amazon Cloudfront CDN.
I have this current file structure at the moment and I have uploaded and deployed my app through the AWS.
I am also using my own domain name as well.
app/
| index.php
| otherfiles.php
|
|____images/
| image1.jpg
|
|____js/
| scripts.js
|
|____css/
| stylesheet.css
|
|____videos/
movie1.mp4
I have also created some folders in my s3 bucket that map to the folders in the app. So I have a js folder an image folder, movies and so on.
My question is how do I set up the S3 buckets so that requests to mydomain.com/images/image1.jpg map to the bucket and folder and image that is in my s3 bucket?
Also is content that is delivered through the Cloudfront CDN only available through the S3 buckets?
I understand that AWS is a massive subject but I just need a conceptual overview of how this could be implemented.
Many Thanks in advance
Upvotes: 4
Views: 9888
Reputation: 200790
Setup a CloudFront distribution for your domain, and route requests to static assets to an S3 bucket, and route requests to dynamic assets to your Elastic Beanstalk application. You can use the CloudFront Behaviors feature to perform the routing, like what is described in this blog post.
Also is content that is delivered through the Cloudfront CDN only available through the S3 buckets?
No, CloudFront can route to any endpoint, not just S3 buckets.
Upvotes: 3