Skip to content

Commit

Permalink
Add cloudfront distributiom
Browse files Browse the repository at this point in the history
  • Loading branch information
cp-sumi-k committed Feb 19, 2024
1 parent 2d79a1f commit 468ea79
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 29 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/deploy-frontend-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,4 @@ jobs:
no-fail-on-empty-changeset: "1"
parameter-overrides: >-
EnvName=dev,
ZipFileName=canopas_website_SSR_dev_${{ github.sha }}-${{ github.run_attempt }}.zip,
CloudfrontURL=${{ secrets.CLOUDFRONT_URL_VALUE_DEV }}
ZipFileName=canopas_website_SSR_dev_${{ github.sha }}-${{ github.run_attempt }}.zip
88 changes: 61 additions & 27 deletions infrastructure/frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ Parameters:
ZipFileName:
Type: String
Description: Name of the zip file.
CloudfrontURL:
Type: String
Description: Cloudfront URL.


Resources:
HttpApiFunction:
Expand All @@ -41,27 +39,63 @@ Resources:
FunctionUrlConfig:
AuthType: NONE

# CloudFrontDistribution:
# Type: AWS::CloudFront::Distribution
# Properties:
# DistributionConfig:
# PriceClass: PriceClass_All
# HttpVersion: http2
# IPV6Enabled: true
# Comment: Distribution with Lambda Function URL
# Origins:
# - DomainName:
# Fn::Select: [2,
# Fn::Split: [ "/",
# Fn::GetAtt: LambdaFunctionUrl.FunctionUrl ]]
# Id: LambdaOrigin
# CustomOriginConfig:
# HTTPSPort: 443
# OriginProtocolPolicy: https-only
# Enabled: 'true'
# DefaultCacheBehavior:
# TargetOriginId: LambdaOrigin
# CachePolicyId: '658327ea-f89d-4fab-a63d-7e88639e58f6'
# ViewerProtocolPolicy: redirect-to-https
# SmoothStreaming: 'false'
# Compress: 'true'
CloudFrontDistribution:
Type: AWS::CloudFront::Distribution
Properties:
DistributionConfig:
PriceClass: PriceClass_All
HttpVersion: http2
IPV6Enabled: true
Comment: Distribution with SSR Lambda Function URL
Origins:
- DomainName:
Fn::Select: [2,
Fn::Split: [ "/",
Fn::GetAtt: LambdaFunctionUrl.FunctionUrl ]]
Id: SSRLambda
CustomOriginConfig:
HTTPPort: 80
HTTPSPort: 443
OriginProtocolPolicy: match-viewer
- DomainName: canopas-website-ssr-dev.s3.ap-south-1.amazonaws.com
Id: StaticS3
CustomOriginConfig:
HTTPPort: 80
HTTPSPort: 443
OriginProtocolPolicy: match-viewer
Enabled: 'true'
DefaultCacheBehavior:
AllowedMethods:
- GET
- HEAD
- OPTIONS
TargetOriginId: SSRLambda
ViewerProtocolPolicy: redirect-to-https
CachePolicyId: 4135ea2d-6df8-44a3-9df3-4b5a84be39ad
OriginRequestPolicyId: b689b0a8-53d0-40ab-baf2-68738e2966ac
CacheBehaviors:
- PathPattern: /_nuxt/*
AllowedMethods:
- GET
- HEAD
- OPTIONS
CachePolicyId: 658327ea-f89d-4fab-a63d-7e88639e58f6
OriginRequestPolicyId: 88a5eaf4-2fd4-4709-b370-b4c650ea3fcf
ResponseHeaderPolicyId: 5cc3b908-e619-4b99-88e5-2cf7f45965bd
TargetOriginId:
Ref: StaticS3
ViewerProtocolPolicy: redirect-to-https
- PathPattern: /sitemap.xml
AllowedMethods:
- GET
- HEAD
- OPTIONS
CachePolicyId: 658327ea-f89d-4fab-a63d-7e88639e58f6
OriginRequestPolicyId: 88a5eaf4-2fd4-4709-b370-b4c650ea3fcf
ResponseHeaderPolicyId: 5cc3b908-e619-4b99-88e5-2cf7f45965bd
TargetOriginId:
Ref: StaticS3
ViewerProtocolPolicy: redirect-to-https



0 comments on commit 468ea79

Please sign in to comment.