🌐 This repository contains the configuration for deploying a static website on AWS using S3 for hosting and CloudFront for content delivery.
- Terraform >= [1.6.6]
- AWS CLI >= [2.13.28]
- Git >= [2.37.1]
- AWS account with IAM credentials with appropriate permissions
- Configuration of secrets in GitHub for AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, and AWS_DEFAULT_REGION
-
Clone the repository:
git clone https://github.com/francotel/static-website-s3-tf.git cd static-website-s3-tf
-
Diagram:
-
Scalability & Durability: S3 offers high scalability and exceptional durability, ensuring data integrity for large-scale storage needs.
-
Cost-Effectiveness: Its pay-as-you-go pricing model allows payment for only the storage and data transfer utilized.
-
User-Friendly: Provides an intuitive interface and robust API for managing and accessing stored data.
-
Security: Offers advanced security options including access control policies, encryption, and auditing.
-
Speed & Performance: CloudFront uses a global network of servers (edge locations) to distribute content from closer locations, enhancing load speed.
-
Auto-Scaling: Automatically scales to handle traffic spikes, ensuring consistent performance during high-demand periods.
-
Bandwidth Optimization: Reduces origin server load by caching static and dynamic content, minimizing load on the origin infrastructure.
-
Advanced Security: Provides security features like SSL/TLS, DDoS protection, and options to restrict content access.
-
Static Websites: S3 is ideal for hosting static sites like web pages, blogs, or single-page applications (SPAs).
-
Media Streaming & Large File Storage: S3 facilitates easy storage and delivery of multimedia content, such as videos, music, or large files.
-
Global Content Distribution: CloudFront accelerates global content delivery, ensuring faster content delivery to end-users.
-
Scalable Web Applications: The combination of S3 and CloudFront suits applications requiring scalability and global performance, such as enterprise applications or streaming services.
name: Deploy Terraform to AWS
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup Terraform
uses: hashicorp/setup-terraform@v1
with:
cli_config_credentials_token: ${{ secrets.AWS_ACCESS_KEY_ID }}
cli_config_credentials_secret: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws_region: ${{ secrets.AWS_DEFAULT_REGION }}
- name: Terraform Init
run: terraform init
- name: Terraform Plan
run: terraform plan -out=tfplan
- name: Terraform Apply
run: terraform apply tfplan -auto-approve
Contributions are welcome! If you'd like to enhance this project, feel free to submit a pull request.
If you found this project helpful or useful and would like to support its development, consider buying me a coffee! Your support helps in maintaining and improving this project.
Your contribution means a lot! Thank you for your support! ❤️
This project is licensed under the MIT License - see the LICENSE file for details.