Build a Unique Domain Hosting Environment with Amazon Route 53, AWS WAF, Amazon CloudFront, and Amazon S3
I built a unique domain hosting environment with Amazon Route 53, AWS WAF, Amazon CloudFront, and Amazon S3 π
Advance Preparation
- Upload the set of files you want to publish to Amazon S3 in advance.
- You can leave the settings private.
Flow of construction
- Register your domain name on Amazon Route 53
- Publishing using Amazon CloudFront and Amazon S3
- Creating an A record for Amazon CloudFront in Amazon Route 53
- SSL certificate settings in Amazon CloudFront
- Publishing with AWS WAF and Amazon CloudFront
Register your domain name on Amazon Route 53
First, register your domain name with Amazon Route 53.
AWS Console β Click "Route 53.β
Search for the domain you want to purchase β click "Add to Cart" β Click "Continue."
Enter each contact information β Click "Continue."
After verifying your email, check the auto-renewal and terms of service. β Click "Complete your order."
It will appear on your pending requests.
After a while, when it appears in the registered domains, the purchase registration is complete.
Publishing using Amazon CloudFront and Amazon S3
Next, we will publish using a combination of Amazon CloudFront and Amazon S3.
AWS Console β Click "CloudFront.β
Click "Create CloudFront Distribution.β
Specify the domain of the target S3, specify the S3 bucket access, set the policy to auto-update, and set the settings to redirect to HTTPS. Set the root object to index.html in S3. Leave the rest of the settings as default.
After creation, check the S3 bucket to confirm that the policy has been set automatically.
Try accessing the URL of the CloudFront distribution for S3 that was created.
S3 is accessed via CloudFront, and the WebSite is displayed.
Creating an A record for Amazon CloudFront in Amazon Route 53
Next, create an A record for Amazon CloudFront in Amazon Route 53.
Click "Host Zone" β Click the target domain name.
Select A record as the record type, select CloudFront as the routing destination, enter the CloudFront domain, and click "Create Record."
The A record settings will be displayed.
SSL certificate settings in Amazon CloudFront
Next, configure the SSL certificate settings for Amazon CloudFront.
Select the target distribution β Click "Edit."
Configure the rest of the settings in AWS Certificate Manager. Select "Request a public certificate" β Click "Next."
Enter the domain name to issue a certificate, select DNS validation, and click "Request."
Click on the configured certificate ID.
Click "Create Record with Route 53."
The CNAME record settings will be displayed.
Return to the target distribution. Select the domain name to issue a certificate and the issued certificate β Click "Save changes." If the certificate is not displayed, reload the browser.
Confirm that the certificate has been set up.
Make sure that the certificate is also in the issued status in AWS Certificate Manager.
Once the configuration is complete, the WebSite will appear with its domain.
Publishing with AWS WAF and Amazon CloudFront
Lastly, we will publish using a combination of AWS WAF and Amazon CloudFront.
AWS Console β Click βWAF & Shield.β
Set an arbitrary name. Select CloudFront as the resource type. Select the target CloudFront distribution. Leave the other settings as default this time.
Confirm the settings β Click βCreate web ACL.β
Click on the Web ACL that has been created.
You can check the details of the Web ACL.
By using Amazon Route 53, Amazon CloudFront, and Amazon S3, it is possible to build a hosting environment for your own domain. It is also possible to customize settings such as request limits using AWS WAF π‘
In the future, I'd like to experiment with AWS Amplify, AWS CloudFormation, AWS CDK, etc. to see how far each service configuration can be defined.
Related Articles