{
    "Description": "AWS CloudFormation Sample Template CloudFront_S3: Sample template showing how to create an Amazon CloudFront distribution using an S3 origin. **WARNING** This template creates a CloudFront distribution. You will be billed for the AWS resources used if you create a stack from this template.",
    "Outputs": {
        "DistributionId": {
            "Value": {
                "Ref": "myDistribution"
            }
        },
        "DistributionName": {
            "Value": {
                "Fn::Join": [
                    "",
                    [
                        "http://",
                        {
                            "Fn::GetAtt": [
                                "myDistribution",
                                "DomainName"
                            ]
                        }
                    ]
                ]
            }
        }
    },
    "Parameters": {
        "S3DNSName": {
            "Description": "The DNS name of an existing S3 bucket to use as the Cloudfront distribution origin",
            "Type": "String"
        }
    },
    "Resources": {
        "myDistribution": {
            "Properties": {
                "DistributionConfig": {
                    "DefaultCacheBehavior": {
                        "ForwardedValues": {
                            "QueryString": "false"
                        },
                        "TargetOriginId": "Origin 1",
                        "ViewerProtocolPolicy": "allow-all"
                    },
                    "Enabled": "true",
                    "HttpVersion": "http2",
                    "Origins": [
                        {
                            "DomainName": {
                                "Ref": "S3DNSName"
                            },
                            "Id": "Origin 1",
                            "S3OriginConfig": {}
                        }
                    ]
                }
            },
            "Type": "AWS::CloudFront::Distribution"
        }
    }
}