I'm trying to automate spinning up a CloudFront distribution with S3 origin. I'd like to set the origin to the S3 website URL, e.g. mysite.com.s3-website-us-east-1.amazonaws.com
. So, I thought my Cloudformation template should look like this:
{
"AWSTemplateFormatVersion" : "2010-09-09",
"Resources" : {
"myDistribution" : {
"Type" : "AWS::CloudFront::Distribution",
"Properties" : {
"DistributionConfig" : {
"Origins" : [ {
"DomainName" : "mysite.com.s3-website-us-east-1.amazonaws.com",
"Id" : "myS3Origin",
...
However that yields the following error:
The parameter Origin DomainName does not refer to a valid S3 bucket.
Which is true, so I can specify the S3 bucket. But I want my origin to be the website endpoint. My non-automated workaround is to deploy with the S3 REST endpoint and update the origin in the UI after.
{
"AWSTemplateFormatVersion" : "2010-09-09",
"Resources" : {
"myDistribution" : {
"Type" : "AWS::CloudFront::Distribution",
"Properties" : {
"DistributionConfig" : {
"Origins" : [ {
"DomainName" : "mysite.com.s3.amazonaws.com",
"Id" : "myS3Origin",
...
According to the docs:
The DNS name of the Amazon Simple Storage Service (S3) bucket or the HTTP server from which you want CloudFront to get objects for this origin.
I can't find anything about a website endpoint origin. http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-origin.html#cfn-cloudfront-origin-originpath
I don't think you've included quite all the relevant parts of your configuration.
The issue here is that an origin that is an S3 website hosting endpoint is not an S3 origin -- it's a custom origin.
Anything other than the REST endpoint of a bucket is always a custom origin.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With