This project is built, tested and deployed to AWS CodeBuild. Artifacts are served from S3. CloudFront is used as a CDN. Route 53 is used for DNS.
All commands below must be run in the /infrastructure directory.
To deploy to AWS, you must:
- Install Terraform and make sure it is in your PATH.
- Set your AWS credentials using one of the following options:
- Set your credentials as the environment variables
AWS_ACCESS_KEY_ID
andAWS_SECRET_ACCESS_KEY
. - Run
aws configure
and fill in the details it asks for. - Run on an EC2 instance with an IAM Role.
- Run via CodeBuild or ECS Task with an IAM Role (see buildspec-test.yml for workaround)
- Set your credentials as the environment variables
- Update and export all environment variables specified in the appropriate buildspec declaration (check all phases) and bash scripts
- Initialise Terraform:
terraform init \
-backend-config 'bucket=YOUR_S3_BUCKET' \
-backend-config 'key=YOUR_S3_KEY' \
-backend-config 'region=YOUR_REGION' \
-get=true \
-upgrade=true
terraform plan -out main.tfplan
terraform apply main.tfplan
- Update and export all environment variables specified in the appropriate buildspec declaration (check all phases) and bash scripts
- Make necessary infrastructure code changes.
- Initialise Terraform:
terraform init \
-backend-config 'bucket=YOUR_S3_BUCKET' \
-backend-config 'key=YOUR_S3_KEY' \
-backend-config 'region=YOUR_REGION' \
-get=true \
-upgrade=true
terraform plan -out main.tfplan
terraform apply main.tfplan
- Update and export all environment variables specified in the appropriate buildspec declaration (check all phases) and bash scripts
- Initialise Terraform:
terraform init \
-backend-config 'bucket=YOUR_S3_BUCKET' \
-backend-config 'key=YOUR_S3_KEY' \
-backend-config 'region=YOUR_REGION' \
-get=true \
-upgrade=true
terraform destroy