This project demonstrates how to deploy a React application using AWS CloudFront and S3 for hosting. The architecture involves registering a domain with Route53 to make the CloudFront-distributed app accessible via a custom URL (bp1.enricogoerlitz.com). The infrastructure setup is managed through Terraform, while GitHub Actions is used for continuous integration and deployment.
Setting up Infrastructure
$ terraform init
$ terraform plan
$ terraform apply
GitHub Workflow Steps:
- Setup CI/CD Server
- Build React-App
- Configure AWS Credentials
- Clear S3 Bucket
- Copy generated build folder to S3 Bucket
The React application is built and stored in an S3 bucket. AWS CloudFront is configured to serve the content from the S3 bucket, ensuring fast and secure delivery.
A custom domain (bp1.enricogoerlitz.com) is registered using AWS Route53. The domain is configured to point to the CloudFront distribution, making the React app accessible via the custom URL.
Terraform scripts are used to automate the creation of the necessary AWS resources, including the S3 bucket, CloudFront distribution, and Route53 domain setup. This ensures a consistent and reproducible infrastructure setup.
The project's source code and Terraform configurations are stored in a GitHub repository. This allows for version control and collaboration.
GitHub Actions are utilized to automate the CI/CD pipeline. The pipeline includes steps to build the React application, configure AWS credentials, clear the S3 bucket, and deploy the new build to the S3 bucket. This ensures that every code change is automatically tested and deployed, streamlining the development workflow.