A Infrastructure-as-Code project that deploys a static S3 website with CloudFront distribution.
Explore the docs »
Report Bug
Table of Contents
This repository demonstrates DevOps practices including containerization, testing, infrastructure as code, and CI/CD. It deploys a static website to AWS using S3 and CloudFront, serving as my virtual business card/resume at www.jdnguyen.tech.
Are you looking over projects for the Learn To Cloud internship? Please also check out my Python-based project at https://github.com/jonathan-d-nguyen/payment-notification-aggregator
Thanks!
Get up and running quickly with these basic steps. For detailed instructions, see Full Installation Steps.
-
AWS CLI
# Install AWS CLI curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" unzip awscliv2.zip sudo ./aws/install # Configure AWS credentials aws configure
-
Docker
# Install Docker (Ubuntu example) curl -fsSL https://get.docker.com -o get-docker.sh sudo sh get-docker.sh # Start Docker service sudo systemctl start docker sudo systemctl enable docker
-
Required AWS Permissions
- S3 full access
- CloudFront full access
- Route 53 domains full access
- ACM certificate manager full access
-
Clone and prepare
git clone https://github.com/jonathan-d-nguyen/portfolio-devops_resume.git cd portfolio-devops_resume
-
Deploy infrastructure
docker-compose run --rm terraform init docker-compose run --rm terraform apply
-
Deploy website
docker-compose run --rm --entrypoint aws aws s3 cp --recursive /app/website_files s3://your-domain.com
-
Repository Setup
git clone https://github.com/jonathan-d-nguyen/portfolio-devops_resume.git cd portfolio-devops_resume
-
Infrastructure Deployment
# Initialize Terraform docker-compose run --rm terraform init # Preview changes docker-compose run --rm terraform plan # Apply infrastructure docker-compose run --rm terraform apply
Save the outputs:
cloudfront_distribution_id = "XXXXXXXXXXXX" website_bucket_url = "your-domain.com.s3..."
-
Website Deployment
docker-compose run --rm --entrypoint aws aws s3 cp --recursive /app/website_files s3://your-domain.com
-
Domain Configuration
-
Certificate Setup (ACM)
- Navigate to ACM in us-east-1 region
- Request public certificate for your domain
- Add domain names:
your-domain.com *.your-domain.com
- Choose DNS validation
- Create validation records in Route 53
-
DNS Setup (Route 53)
- Create/select hosted zone
- Update nameserver records at your registrar
- Create records:
A record: your-domain.com → CloudFront distribution CNAME record: www.your-domain.com → your-domain.com
-
CloudFront Setup
- Configure alternate domain names
- Select ACM certificate
- Set default root object: index.html
- Configure price class
- Set up custom error responses if needed
-
-
Infrastructure Tests
# Run test suite docker-compose run --rm test # Verify S3 bucket aws s3 ls s3://your-domain.com # Check CloudFront status aws cloudfront get-distribution --id YOUR_DISTRIBUTION_ID
-
Website Verification
- Visit https://your-domain.com
- Test www and non-www domains
- Verify all pages load
- Check SSL certificate validity
- Confirm CDN caching
-
Certificate Issues
# Check certificate status aws acm describe-certificate --certificate-arn arn:aws:acm:region:account:certificate/certificate-id # Verify DNS validation dig www.your-domain.com
-
CloudFront Problems
# Invalidate cache aws cloudfront create-invalidation --distribution-id YOUR_DISTRIBUTION_ID --paths "/*" # Check distribution status aws cloudfront get-distribution --id YOUR_DISTRIBUTION_ID
-
S3 Access Issues
- Verify bucket policy
- Check CloudFront OAC settings
- Confirm bucket name matches domain
The included Jenkins pipeline automates deployment:
-
Pipeline Setup
- Install required Jenkins plugins
- Create new pipeline job
- Configure GitHub webhook
- Point to Jenkinsfile
-
Pipeline Stages
- Build
- Test
- Deploy infrastructure
- Deploy website
- Verification
# Remove infrastructure
docker-compose run --rm terraform destroy
# Clean Docker resources
docker-compose down -v
docker system prune -f
# Remove local files
rm -rf .terraform
rm -rf terraform.tfstate*
- Jenkins Deploy
- Implement automated deployment using Jenkins CI/CD pipeline
- Terraform State Management
- Implement state persistence in S3 for better collaboration and versioning
- CloudFront Integration
- Set up CloudFront distribution for content delivery
- Configure Origin Access Control for enhanced security
- Implement public access blocking for S3 origin
- Integrate AWS Certificate Manager for HTTPS
- Configure Route 53 for domain management
See the open issues for a full list of proposed features (and known issues).
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the MIT License. See LICENSE.txt
for more information.
Jonathan Nguyen - [email protected]
Project Link: https://github.com/jonathan-d-nguyen/portfolio-devops_resume