Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document how to use the AWS terraform config #1991

Merged
merged 6 commits into from
Jul 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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