Created
October 19, 2017 21:33
-
-
Save xschildw/f6e260d50a834bb7afc5fb3633484c3e to your computer and use it in GitHub Desktop.
CloudFormation template for CloudFront distribution
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| AWSTemplateFormatVersion: '2010-09-09' | |
| Description: > | |
| A template to deploy CloudFront stack | |
| Parameters: | |
| StackTypeParameter: | |
| Type: String | |
| AllowedValues: | |
| - tst | |
| - staging | |
| - www | |
| Description: Enter Stack type (tst, staging or www). | |
| SslCertIdParameter: | |
| Type: String | |
| Description: Enter the ID of the ACM certificate to use. | |
| Resources: | |
| stackDistribution: | |
| Type: 'AWS::CloudFront::Distribution' | |
| Properties: | |
| DistributionConfig: | |
| Origins: | |
| - DomainName: !Join [".", [!Ref StackTypeParameter, synapse.org]] | |
| Id: !Join ["", [cdn-, !Ref StackTypeParameter, .synapse.org]] | |
| CustomOriginConfig: | |
| HTTPPort: '80' | |
| HTTPSPort: '443' | |
| OriginProtocolPolicy: https-only | |
| OriginSSLProtocols: | |
| - TLSv1 | |
| - TLSv1.1 | |
| - TLSv1.2 | |
| - SSLv3 | |
| Enabled: 'true' | |
| Comment: !Join [" ", ["CloudFront distribution for ", !Ref StackTypeParameter, "stack"]] | |
| HttpVersion: http2 | |
| Aliases: | |
| - !Join ["", [cdn-, !Ref StackTypeParameter, .synapse.org]] | |
| DefaultCacheBehavior: | |
| AllowedMethods: | |
| - GET | |
| - HEAD | |
| - OPTIONS | |
| ForwardedValues: | |
| QueryString: 'false' | |
| SmoothStreaming: 'false' | |
| TargetOriginId: !Join ["", [cdn-, !Ref StackTypeParameter, .synapse.org]] | |
| ViewerProtocolPolicy: allow-all | |
| PriceClass: PriceClass_All | |
| ViewerCertificate: | |
| AcmCertificateArn: !Join ["", ['arn:aws:acm:us-east-1:', !Ref 'AWS::AccountId', ':certificate/', !Ref SslCertIdParameter]] | |
| SslSupportMethod: sni-only | |
| Outputs: | |
| CloudFrontDistributionId: | |
| Description: The ID of the CF distribution | |
| Value: Ref | |
| Export: | |
| Name: !Join ["-", ["CFDistID", !Ref StackTypeParameter]] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment