I have a Cloudfront service which points to an index.html file in a S3 bucket.
Calling the Cloudfront URL is rendering the application which is correct.
I now want to use a custom "path" that gets appended to the Cloudfront.
So instead https://asdf.cloudfront.net/ I want to use https://asdf.cloudfront.net/my-app/ to point to my S3 bucket.
Is this possible with Cloudfront or do I have to move my s3 bucket content into a folder and then point to it?
Related
How do I compose a CDN URL using an S3 asset using CloudFront?
As I went through a guide provided by Amazon, I wasn't clear to me how the final URL should be composed using the CloudFront's origin or domain, and the path to the S3 asset within the S3 bucket that the CloudFront distribution points to.
Use the CloudFront distribution's Alternative Domain Name and the path to the asset in the S3 bucket.
[Alternative Domain Name]/[path to the asset]
So for example, if the Alternative Domain Name is:
my-assets.my-domain.com
And the path to the asset in the referenced S3 bucket is:
some-directory/some-static-files/my-image.jpg
The CDN URL would be:
https://my-assets.my-domain.com/some-directory/some-static-files/my-image.jpg
I have a CloudFront distribution in front of a S3 static website.
I want all traffic where first path element is profile to be directed to one file in my bucket.
For example, for a GET request to https://example.com/profile/12345, I want CloudFront to return S3 object s3://<bucket_name>/profile/index.html.
My goal is that I would handle dynamic content for profile/12345 using frontend JS and my API.
I have an S3 bucket and Cloud Front distribution to deliver assets (PDF files) to my site and CMS. I want users to be able to access the PDF, but
I noticed that if I use either the S3 or Could Front URLs that I can erase the file name (e.g., my-bucket.s3.amazonaws.com/file.pdf or cloudfront-domain-name/file.pdf) and see an XML tree of the S3 or Cloud Front that displays all the content (filenames of all the PDFs, and the S3 URL in the case of the CloudFront URL).
How can I prevent somebody from doing this?
make the bucket not open to public, the it wont list the contents in the bucket
How can I attach an S3 bucket to an URL on my site. I tried but could not get it to work.
For instance my URL is:
mysite.com/media
And my S3 bucket should be linked directly to the above URL?
You're going to want to use CloudFront in front of S3. This will allow you to use your domain and serve content from S3.
Check out Using CloudFront with Amazon S3 for details on how to do it.
With an S3 static site, I am able to hit /directory and it will serve up the index.html file inside the directory. Once I add the S3 bucket as a CloudFront origin, I instead get an Access Denied message.
How can I replicate this S3 functionality in CloudFront?
The fix was to setup S3 static site hosting and use CloudFront to point to it as a remote origin website instead of an S3 bucket.