Skip to content

Commit

Permalink
Document how to use the AWS terraform config (#1991)
Browse files Browse the repository at this point in the history
* Document how to use the AWS terraform config

* Update Guide/deployment.markdown

Co-authored-by: Marc Scholten <marc@digitallyinduced.com>

* Update Guide/deployment.markdown

Co-authored-by: Marc Scholten <marc@digitallyinduced.com>

* Update Guide/deployment.markdown

Co-authored-by: Marc Scholten <marc@digitallyinduced.com>

* Update Guide/deployment.markdown

Co-authored-by: Marc Scholten <marc@digitallyinduced.com>

* Update Guide/deployment.markdown

Co-authored-by: Marc Scholten <marc@digitallyinduced.com>

---------

Co-authored-by: Marc Scholten <marc@digitallyinduced.com>
  • Loading branch information
mokshasoft and mpscholten authored Jul 30, 2024
1 parent 0cc8531 commit 147895e
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions Guide/deployment.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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
2. Setup AWS credentials in `.aws/config` and `.aws/credentials`
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
```
4. 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.
5. Run:
```
terraform apply
```
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.

#### 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
Expand Down

0 comments on commit 147895e

Please sign in to comment.