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
Top comments (2)
I recommend looking at IaC like AWS CDK!
Thank you! I will post articles on AWS Amplify, AWS CloudFormation, and AWS CDK in future series.