From 07e45c223067b5b0742bfb0cd0019deabc0df625 Mon Sep 17 00:00:00 2001 From: Jonas Claeson Date: Tue, 16 Jul 2024 22:44:59 +0200 Subject: [PATCH 1/6] Document how to use the AWS terraform config --- Guide/deployment.markdown | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/Guide/deployment.markdown b/Guide/deployment.markdown index 21180735d..5f99aeea2 100644 --- a/Guide/deployment.markdown +++ b/Guide/deployment.markdown @@ -12,6 +12,35 @@ AWS EC2 is a good choice for deploying IHP in a professional setup. ### AWS infrastructure preparation +#### Creating infrastructure with Terraform + +The EC2 instance, RDS database, VPS, subnets, security groups, etc, can be setup automatically using [Terraform](https://www.terraform.io/). + +1. Install terraform +1. Setup AWS credentials in .aws/config and .aws/credentials +1. Go to the folder IaC/aws. If the folder doesn't exist in the repo, get it from [ihp-boilerplate](https://github.com/digitallyinduced/ihp-boilerplate) Run: + ``` + terraform init + ``` +1. Create the file `terraform.tfvars` with the following content: + ``` + prefix = "Project prefix for the resource names" + region = "AWS Region to deploy to" + az_1 = "Availability Zone 1" + az_2 = "Availability Zone 2" + key_name = "The key name of the SSH key-pair" + db_password = "The password for the RDS database" + ``` + - The two AZs are needed to setup the RDS database. + - The SSH key-pair should be created in the AWS web interface. +1. Run: + ``` + terraform apply + ``` +1. Important data like the RDS endpoint and the EC2 instance URL is written to the file `db_info.txt` + +Now the NixOS instance and Postgres database is setup and an SSH conncetion can be established to it. + #### Creating a new EC2 Instance Start a new EC2 instance and use the official NixOS AMI `NixOS-23.05.426.afc48694f2a-x86_64-linux`. You can find the latest NixOS AMI at https://nixos.org/download#nixos-amazon From 81638735ae1f463dbea4802fd7e7822bc6fe6851 Mon Sep 17 00:00:00 2001 From: mokshasoft Date: Fri, 19 Jul 2024 21:20:24 +0200 Subject: [PATCH 2/6] Update Guide/deployment.markdown Co-authored-by: Marc Scholten --- Guide/deployment.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Guide/deployment.markdown b/Guide/deployment.markdown index 5f99aeea2..a89684956 100644 --- a/Guide/deployment.markdown +++ b/Guide/deployment.markdown @@ -17,7 +17,7 @@ AWS EC2 is a good choice for deploying IHP in a professional setup. The EC2 instance, RDS database, VPS, subnets, security groups, etc, can be setup automatically using [Terraform](https://www.terraform.io/). 1. Install terraform -1. Setup AWS credentials in .aws/config and .aws/credentials +2. Setup AWS credentials in `.aws/config` and `.aws/credentials` 1. Go to the folder IaC/aws. If the folder doesn't exist in the repo, get it from [ihp-boilerplate](https://github.com/digitallyinduced/ihp-boilerplate) Run: ``` terraform init From 0a2fea23629b2a761310f90e72572c3891727182 Mon Sep 17 00:00:00 2001 From: mokshasoft Date: Fri, 19 Jul 2024 21:20:45 +0200 Subject: [PATCH 3/6] Update Guide/deployment.markdown Co-authored-by: Marc Scholten --- Guide/deployment.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Guide/deployment.markdown b/Guide/deployment.markdown index a89684956..d4eda5689 100644 --- a/Guide/deployment.markdown +++ b/Guide/deployment.markdown @@ -18,7 +18,7 @@ The EC2 instance, RDS database, VPS, subnets, security groups, etc, can be setup 1. Install terraform 2. Setup AWS credentials in `.aws/config` and `.aws/credentials` -1. Go to the folder IaC/aws. If the folder doesn't exist in the repo, get it from [ihp-boilerplate](https://github.com/digitallyinduced/ihp-boilerplate) Run: +3. Go to the folder IaC/aws. If the folder doesn't exist in the repo, get it from [ihp-boilerplate](https://github.com/digitallyinduced/ihp-boilerplate) Run: ``` terraform init ``` From d6c1d6f999a0eb7c83434d89344755d987a01861 Mon Sep 17 00:00:00 2001 From: mokshasoft Date: Fri, 19 Jul 2024 21:20:58 +0200 Subject: [PATCH 4/6] Update Guide/deployment.markdown Co-authored-by: Marc Scholten --- Guide/deployment.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Guide/deployment.markdown b/Guide/deployment.markdown index d4eda5689..4892c784c 100644 --- a/Guide/deployment.markdown +++ b/Guide/deployment.markdown @@ -22,7 +22,7 @@ The EC2 instance, RDS database, VPS, subnets, security groups, etc, can be setup ``` terraform init ``` -1. Create the file `terraform.tfvars` with the following content: +4. Create the file `terraform.tfvars` with the following content: ``` prefix = "Project prefix for the resource names" region = "AWS Region to deploy to" From 99293d5cdc9f2b3e7feebd0def6ed652df061253 Mon Sep 17 00:00:00 2001 From: mokshasoft Date: Fri, 19 Jul 2024 21:21:06 +0200 Subject: [PATCH 5/6] Update Guide/deployment.markdown Co-authored-by: Marc Scholten --- Guide/deployment.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Guide/deployment.markdown b/Guide/deployment.markdown index 4892c784c..feaf66e87 100644 --- a/Guide/deployment.markdown +++ b/Guide/deployment.markdown @@ -33,7 +33,7 @@ The EC2 instance, RDS database, VPS, subnets, security groups, etc, can be setup ``` - The two AZs are needed to setup the RDS database. - The SSH key-pair should be created in the AWS web interface. -1. Run: +5. Run: ``` terraform apply ``` From 5162703f8505e9c1519099ae078f1dcdc3a4d662 Mon Sep 17 00:00:00 2001 From: mokshasoft Date: Fri, 19 Jul 2024 21:21:16 +0200 Subject: [PATCH 6/6] Update Guide/deployment.markdown Co-authored-by: Marc Scholten --- Guide/deployment.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Guide/deployment.markdown b/Guide/deployment.markdown index feaf66e87..03b60b79e 100644 --- a/Guide/deployment.markdown +++ b/Guide/deployment.markdown @@ -37,7 +37,7 @@ The EC2 instance, RDS database, VPS, subnets, security groups, etc, can be setup ``` terraform apply ``` -1. Important data like the RDS endpoint and the EC2 instance URL is written to the file `db_info.txt` +6. Important data like the RDS endpoint and the EC2 instance URL is written to the file `db_info.txt` Now the NixOS instance and Postgres database is setup and an SSH conncetion can be established to it.