This project sets up a static website hosting architecture on AWS using IaC (Infrastructure as Code) with the Terraform. The solution is implemented including AWS services like Route53, CloudFront, S3, Amazon Certificate Manager to provide a highly available, scalable and secure hosting environment.
- Static content hosting: stores website files (HTML) in a private S3 Bucket.
- Global content delivery: uses CloudFront for low-latency delivery across edge locations worldwide
- Secure access: Enforces HTPPS using SSL/TLS certificates managed by ACM -Flexible infrastructure: Automated setup with Terraform, ensuring consistency and replicability
- DNS Management: Configures Route53 for custom domain integration
- Install Terraform.
- Configure AWS CLI with your credentials (aws configure).
- Ensure you have programmatic access enabled for your AWS account.
- Clone the Repository:
git clone https://github.com/LouisGreive/CloudWebHost
cd CloudWebHost- Configure Variables:
- Edit the file named terraform.tfvars in the root directory.
- Define values for the required variables:
# The primary region in which your AWS resources (like S3, Route53, etc.) will be created.
aws_region = "your-region"
# The domain name you want to manage in Route53 and use for the CloudFront distribution.
domain_name = "yourdomain.com"
# The name of the S3 bucket that will host your static website files.
bucket_name = "website-name-frontend"
# Common tags to apply to various resources, aiding in cost allocation and organization.
common_tags = {
ManagedBy = "Terraform"
Project = "Static Website"- Deploy the infrastructure:
- Initialize Terraform:
terraform init- Plan the changes:
terraform plan- Apply the configuration:
terraform plan- Confirm by typing yes when prompted
- Access the website:
- Terraform outputs the CloudFront URL
- Open the URL in a browser to view the deployed website.
- Verified the site’s global accessibility by testing from different regions.
- Updated S3 content to validate cache behavior in CloudFront.
- Confirmed secure HTTPS access and restricted S3 permissions.
To remove all resources created by terraform, run:
terraform destroyContributions to this project are welcome!
- Report bugs, suggest enhancements, or contribute code.
- Feel free to open an issue or submit a pull request.
Project developed as part of the Cloud Programming Module in the Bachelor of Applied Artificial Inteligence program at IU International University of Applied Sciences.
Special thanks to the program tutor : Mr Georgi Dimchev.