Terraform configuration for deploying a static website to Amazon S3 using the CloudFront distribution.
The following infrastructure will be deployed:
- S3 Bucket
- CloudFront distribution
- Route53 record
Official instruction guide: https://learn.hashicorp.com/tutorials/terraform/install-cli
- Create a non-root IAM user.
- Give necessary permissions and allow CLI access.
- Copy access ID and secret key
- Download the latest AWS CLI from here: https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html
- Configure the AWS credentials.
aws configure
- Clone the repository.
git clone https://github.com/irfanalamt/terraform-aws.git
- In your terminal, navigate to the project root directory.
cd terraform-aws
- Initialize a working directory containing Terraform config files.
terraform init
- Create an execution plan.
terraform plan
- Execute changes defined in Terraform configuration.
terraform apply
Destroy all provisioned infrastructure. terraform destroy