s-gov-uk-prod
appsync.yml and /scripts are necessary to use by AWS Code Deploy integrated with GitHub – it must be in the root of repository.
Add below secrets to the Github secrets:
Infra secrets:
- INSTANCE_TYPE - Instance type to use
- INBOUND_CIDR - CIDR to allow traffic from
- VPC_ID - VPC ID in which EC2 should be deployed
- SUBNET_ID - Subnet ID in which EC2 should be deployed
- ELASTIC_IP_NAME - Elastic IP name to be used by EC2 for static IP
- KEY_NAME - Key name to be used for EC2
- BACKEND_BUCKET - S3 bucket name to store terraform backend
Application secrets:
- HOST - IP address or domain name of the VM
- PORT - SSH port number
- USERNAME - username to login
- EC2_AUTH - Private key to authenticate to VM
Once the code is merged to master branch, reverse proxy solution will be deployed to the server.
Deploy infra to AWS
- To deploy infrastructure(EC2) to AWS, run the workflow named "Deploy Infra to AWS"
- It accepts input value for "action" and its default value is "plan".
- If "plan" is passed as input, it will only plan and print the
terraform plan
output - If "apply" is passed as the input, it will deploy the infrastructure to the AWS.
- As the EC2 need to use a static IP for the VM, an elastic IP should be created in AWS and the name should be passed as variable.
Destroy infra from AWS
- To delete the infrastructure from AWS, run the workflow named "Destroy Infra"
- It accepts input value for "action" and its default value is "plan"/
- If "plan" is passed as input, it will only plan the destroy and print the
terraform plan -destroy
output - If "destroy" is passed as the input, it will delete the infrastructure from the AWS.