Created
May 1, 2021 09:36
-
-
Save thanakijwanavit/56c05e8e1c944bb81245d34108a96af0 to your computer and use it in GitHub Desktop.
villa kitchen cf distribution config
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' | |
Transform: AWS::Serverless-2016-10-31 | |
Description: > | |
VillaCloudfront endpoint for website backend | |
Parameters: | |
BRANCH: | |
Type: String | |
Default: dev-blank | |
IMAGEDOMAIN: | |
Type: String | |
Default: "group2-image-bucket-dev.s3-ap-southeast-1.amazonaws.com" | |
HOSTEDZONEID: | |
Type: String | |
Default: "Z08731441P8WHU08VC38M" | |
Resources: | |
Route53DNSGroup: | |
Type: 'AWS::Route53::RecordSetGroup' | |
Properties: | |
HostedZoneId: !Ref HOSTEDZONEID | |
RecordSets: | |
- Name: villa.kitchen | |
Type: A | |
AliasTarget: | |
HostedZoneId: Z2FDTNDATAQYW2 | |
DNSName: !GetAtt MainEndpoint.DomainName | |
UrlCertificate: | |
Type: AWS::CertificateManager::Certificate | |
Properties: | |
DomainName: villa.kitchen | |
GroupImageFunction: | |
Type: AWS::Serverless::Function | |
Properties: | |
CodeUri: originOverride/ | |
Handler: groupImage.lambda_handler | |
Runtime: python3.8 | |
MainEndpoint: | |
Type: AWS::CloudFront::Distribution | |
Properties: | |
DistributionConfig: | |
Aliases: | |
- villa.kitchen | |
Origins: | |
- Id: groupImage | |
DomainName: !Ref IMAGEDOMAIN | |
CustomOriginConfig: | |
HTTPPort: '80' | |
HTTPSPort: '443' | |
OriginKeepaliveTimeout: 10 | |
OriginProtocolPolicy: https-only | |
OriginReadTimeout: 10 | |
Enabled: 'true' | |
HttpVersion: http2 | |
DefaultCacheBehavior: | |
TargetOriginId: groupImage | |
ForwardedValues: | |
QueryString: 'false' | |
Cookies: | |
Forward: all | |
ViewerProtocolPolicy: allow-all | |
MinTTL: '100' | |
SmoothStreaming: 'true' | |
CacheBehaviors: | |
- AllowedMethods: | |
- DELETE | |
- GET | |
- HEAD | |
- OPTIONS | |
- PATCH | |
- POST | |
- PUT | |
TargetOriginId: groupImage | |
PathPattern: /group/image/* | |
LambdaFunctionAssociations: | |
- EventType: origin-request | |
IncludeBody: true | |
LambdaFunctionARN: 'arn:aws:lambda:us-east-1:394922924679:function:villaBackendDomain-dev-manual-GroupImage:2' | |
ForwardedValues: | |
QueryString: 'true' | |
Cookies: | |
Forward: none | |
ViewerProtocolPolicy: allow-all | |
MinTTL: '50' | |
CustomErrorResponses: | |
- ErrorCode: '404' | |
ResponsePagePath: "/error-pages/404.html" | |
ResponseCode: '200' | |
ErrorCachingMinTTL: '30' | |
PriceClass: PriceClass_All | |
ViewerCertificate: | |
AcmCertificateArn: !Ref UrlCertificate | |
SslSupportMethod: sni-only | |
Outputs: | |
CFID: | |
Description: main cloudfrontId | |
Value: !Ref MainEndpoint | |
DomainName: | |
Description: root domain | |
Value: !GetAtt MainEndpoint.DomainName |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment