Host a static website on S3 with Cloudflare DNS. Supports SSL. Great for single page apps.
Setup and deployment is as simple as a single command.
- Install Terraform
- Install the AWS CLI
- Install JQ
- Obtain a Cloudflare API Key
- Clone the Repo
git clone https://github.com/bewestphal/terraform-cloudflare-s3-website.git - Populate the
.envfile with required config - Create React App (the demo Single Page App)
npx create-react-app client - Init terraform
terraform init - Apply terraform
terraform apply - Your website will be available at
.env.DOMAINin a few minutes!
To deploy changes to the React App just reapply Terraform
terraform apply
An example script terraform_import.sh provides some examples to import existing resources such as an existing
cloudflare zone.
See the terraform documentation on each resource type for instructions on importing more types.