Customizing the Public link
- SSL Certificate Implementation
- Custom Domain
- Shortens the time and the link itself
Here are the steps for Deploying and Configuring Cloudfront from S3 Bucket :
-
Check the previous day documentations for the steps done till now regarding IAM, S3, CloudFormation
-
Add the following Snippet to the
template.yaml
below the resource tag (This creates a CDN in CloudFront)
MyDistribution:
Type: "AWS::CloudFront::Distribution"
Properties:
DistributionConfig:
DefaultCacheBehavior:
ViewerProtocolPolicy: allow-all
TargetOriginId: ronit-demo-site.s3-us-east-1.amazonaws.com
DefaultTTL: 0
MinTTL: 0
MaxTTL: 0
ForwardedValues:
QueryString: false
Origins:
- DomainName: ronit-demo-site.s3-us-east-1.amazonaws.com
Id: ronit-demo-site.s3-us-east-1.amazonaws.com
CustomOriginConfig:
OriginProtocolPolicy: match-viewer
Enabled: "true"
DefaultRootObject: index.html
-
Go to your IAM User Permissions in AWS Dashboard and give the permission
CloudFrontFullAccess
(Else, it will not create a Distribution through CLI and throw an error) -
Now run command
make deploy-infra
AND HOLA! You have successfully made a CloudFront Link for your site.