Introduction: In our previous blog, we explored setting up a CI/CD pipeline with AWS CodeCommit and S3 hosting. Now, let’s take it a step further by enhancing our website with a subdomain, CDN (Content Delivery Network), and SSL (Secure Sockets Layer) encryption. These additions will improve performance, security, and accessibility for your web application.
Prerequisite:
- An IAM user with required permissions.
- Ensure your S3 bucket is configured for static website hosting.
- Update bucket policy to allow public access and enable static website hosting.
- Specify index and error documents for your website.
Step 1: Generate SSL Certificate with AWS Certificate Manager (ACM)
- Navigate to the AWS Certificate Manager (ACM) service in the AWS Management Console.
- Request a new SSL certificate for your subdomain (e.g., subdomain.yourdomain.com).
- Follow the validation process to verify domain ownership.
- Once validated, the SSL certificate will be issued and available for use.
Note: Make sure to generate SSL Certificate in US-EAST-1 region only.
Step 2: Set Up Subdomain
- Navigate to your DNS management console (e.g., GoDaddy).
- Create a new CNAME record for your subdomain (e.g., subdomain.yourdomain.com) and point it to the S3 website endpoint URL of your production bucket.
HOST | TYPE | VALUE |
areyoua.examnative.com | Cname | areyoua-test.s3-website.ap-south-1.amazonaws.com |
Step 3: Enable CDN (Content Delivery Network) with Amazon CloudFront
- Access the CloudFront service in the AWS Management Console.
- Click “Create Distribution” and select “Web” distribution.
- Specify your S3 bucket as the origin and configure other settings as needed.
- Don’t Enable the WAF Firewall, it will increase your code and not required for this type of websites.
- Associate the SSL certificate issued from ACM with the CloudFront distribution.
- Save the distribution settings and wait for deployment.
Step 4: Test and Verify
- Test your website using the subdomain URL to ensure proper functionality and SSL encryption.
- Verify CDN caching and performance improvements by analyzing website load times from different geographic locations.
Step 5: Renew SSL Certificate
- Monitor SSL certificate expiration dates and renew as needed through the AWS Certificate Manager console.
This post is a continuation of our previous blog. If you haven’t read the last blog, please check it out first using the link provided below:
Conclusion: By following these steps, you’ve successfully enhanced your AWS S3-hosted website with a subdomain, SSL encryption, and CDN. This strategic approach ensures a secure and optimized browsing experience for your visitors while prioritizing security through SSL certificate issuance before implementing CDN for enhanced performance. Stay ahead in the digital realm with an infrastructure optimized for security and efficiency!
Note: The process of generating SSL certificates from AWS Certificate Manager for a subdomain hosted on GoDaddy involves validating domain ownership and configuring DNS settings accordingly. Detailed instructions for this process can be found in the AWS Certificate Manager documentation and GoDaddy’s support resources.