[ English | Japanese ]
This is a sample repository of CloudFront Functions.Built with HCL ( Terraform ).
ref. Amazon CloudFront announces CloudFront Functions, a lightweight edge compute capability
Prepare CLIs.
- AWS CLI
- Terraform CLI via tfenv
Create terraform var file.
$ vim terraform.tfvars
aws_access_key_id = "XXXXXXXXXXXXXXXXXX"
aws_secret_access_key = "YYYYYYYYYYYYYYYYYYYYYYYYY"
region = "ap-northeast-1"
bucket_name = "cloudfront-functions-sample"
# import modules
$ terraform init
# Dry run
$ terraform plan --var-file=terraform.tfvars
# Deploy
$ terraform apply --var-file=terraform.tfvars
Static contents upload via AWS CLI.
$ aws s3 cp ./src s3://<BUCKET NAME>/dist/ --recursive
# Delete static contents from S3 bucket
$ aws s3 rm s3://<BUCKET NAME>/ --recursive
# Dry run
$ terraform plan --var-file=terraform.tfvar --destroy
# Destroy
$ terraform destroy --var-file=terraform.tfvar