A powerful CLI tool that simplifies the deployment of static websites and Single Page Applications (SPAs) to AWS using S3 and CloudFront.
- 🚀 One-command deployment process
- 🔒 Secure by default with CloudFront Origin Access Control
- 📱 Support for both static websites and SPAs
- 💨 Optimal caching configuration
- 🌐 HTTPS enabled by default
- 🎯 Interactive CLI interface
-
Download the latest release for your platform:
-
Configure AWS credentials using one of these methods:
- AWS CLI:
aws configure
- Environment variables:
export AWS_ACCESS_KEY_ID="your_access_key" export AWS_SECRET_ACCESS_KEY="your_secret_key"
- IAM role (if running on AWS infrastructure)
- AWS CLI:
-
Run the executable and follow the interactive prompts
- Go 1.24 or later
- AWS credentials configured
- Required AWS permissions:
- S3: CreateBucket, PutObject, PutBucketPolicy
- CloudFront: CreateDistribution, CreateOriginAccessControl
- IAM: GetUser
-
Install Go (if not already installed):
- Download from golang.org/dl
- Verify installation:
go version
-
Clone and run the project:
# Clone the repository
git clone https://github.com/youssefframy/aws-deploy-static-site.git
cd aws-deploy-static-site
# Install dependencies
go mod tidy
go mod download
# Run directly with Go
go run main.go
The tool provides an interactive CLI interface that will guide you through the deployment process:
-
Select deployment type:
- Static Website (Basic)
- Single Page Application (SPA)
-
Configure deployment settings:
- AWS Profile (optional)
- S3 Bucket Name
- Website Files Location
- CloudFront Distribution Description
- AWS Region
-
Wait for deployment completion (typically 10-15 minutes for CloudFront propagation)
The deployment process:
- Creates a private S3 bucket
- Configures website hosting settings
- Uploads your static files with optimal caching headers
- Creates a CloudFront distribution with Origin Access Control
- Configures security policies and routing rules
- ✅ Private S3 bucket with public access blocked
- ✅ CloudFront Origin Access Control (OAC)
- ✅ HTTPS-only access
- ✅ Secure IAM policies
- ✅ Custom error handling for SPAs
Common issues and solutions:
-
Access Denied
- Verify AWS credentials are configured correctly
- Ensure IAM user has required permissions
-
Bucket Creation Failed
- Check if bucket name is globally unique
- Verify selected region supports all services
-
Upload Issues
- Confirm website folder path is correct
- Check file permissions
-
CloudFront Errors
- Allow 10-15 minutes for distribution deployment
- Verify domain name resolution
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
For bugs and feature requests, please open an issue.