Project 11: CloudForge: Crafting Seamless Website Delivery with Terraform Magic - S3, CloudFront, and ACM Unleashed
Introduction:
π Welcome to CloudForge β where Terraform magic meets AWS wonders! Struggling with complex web hosting setups? Say goodbye to headaches as we unravel the secrets of painless static website deployment on S3, turbocharged delivery via CloudFront, and security fortification using ACM. πβ¨ Experience the magic of seamless web hosting and solve your hosting hassles with ease! π°π»
Technologies Used:
Terraform: Employed for Infrastructure as Code (IaC) to automate and manage cloud resources effortlessly.
Amazon S3: Utilized as a scalable and durable storage solution to host static website content securely.
Amazon CloudFront: Implemented for content delivery, ensuring low-latency access and enhanced user experience globally.
AWS Certificate Manager (ACM): Enabled SSL/TLS certificates management, ensuring secure communication over HTTPS.
Project Overview:

Prerequisites:
Terraform Installed: Make sure Terraform is installed on your machine. Download it here and follow the installation guide.
AWS Account: Have an active AWS account ready with the necessary permissions to create S3 buckets, CloudFront distributions, and ACM certificates.
Your Ready-to-Launch Static Website: Prepare your static website content, ready to take off into the cloud.
A Domain configured with Route53 records.
I will be using this repo for the project : https://github.com/patelajay745/CloudForge
Project:
create provider.tf :

Create variable.tf :

create s3.tf

create cloudfront.tf

create certificate.tf

create route53.tf

Now just run following command to deploy whole infrastructure:
terraform validate
terraform plan
terraform apply --auto-approve
Output :

your website is ready to serve user by their nearest edge location.

Problem faced and how I solved it:
While i was doing this project. I encountered a problem in which my cloudfront URL was showing website content but my domain URL was showing me error of 403. So, After researching I came to know that I forgot to add alternative domain for my cloud front so I added this code to my cloudfront.tf
aliases = [var.domain-name,"www.${var.domain-name}"]
but then I again I came across another error in which my cerficate was not allowing me to add alternative domain. so i found out solution by this code:
subject_alternative_names = [var.domain-name,"www.${var.domain-name}"]
Then It solved.
Few link which helped me to understand and solve my problem :
https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudfront_distribution
Conclusion β¨
Challenges Overcome: Struggling with intricate hosting setups? CloudForge tackles the complexities, turning static website deployment into a breeze.
Benefits Unleashed:
Simplicity: No more headaches; deploy with ease using Terraform.
Global Reach: CloudFront ensures low-latency access globally.
Security: ACM takes care of SSL/TLS certificates for secure communication.
Cost-Efficiency: Scale resources efficiently with AWS S3.
Empowering Individuals & Businesses: CloudForge isn't just a solution; it's a game-changer for both individuals and companies. Experience seamless, secure, and cost-effective web hosting like never before! ππ»
Pro Tip: If you're on a learning journey with this project, remember the magic words - "terraform destroy --auto-approve." It's not just about building; it's about responsibly managing your resources. Save costs and keep learning! β¨π - Ajay Patel ππ‘



