---
title: Applying Hosty blueprint
slug: hosty/applying-hosty-blueprint
createdAt: 2026-11-08T11:27:49.007Z
---

The blueprint is the part of Hosty that every AWS account needs once: the IAM users and groups, the Route53 zone, the S3 buckets for backups, logs and VPN profiles, and the storage for the state of OpenTofu. This page shows how to apply it to a new AWS account. Clusters and projects come after it.

There is a catch at the start. Hosty creates your IAM user, but you need an IAM user to run Hosty. And the state of OpenTofu goes to an S3 bucket that doesn't exist yet. So you start with a temporary user and a local state, and switch to your own user and the S3 state once the blueprint is in place.

![The order of steps to apply the blueprint](https://api.archbee.com/api/optimize/J5fagZai1i-rRUBgkgJC3/EnY4OkdORNlQtsUqdcmGJ_hosty-admin-setup-blueprint.png)

## What you need

- [Hosty installed locally](https://wiki.systemseed.com/hosty/installing-hosty-locally).
- Admin access to the AWS Console of the account, such as the root user.
- A domain for the hosting that you control, for example `example.com` or `hosting.example.com`. Development environments get addresses under it.

## 1. Create a temporary user

1. In the AWS Console, open **IAM** > **Users** and click **Create user**.
2. Enter any name, for example `temp.admin`. You don't need console access for it.
3. On **Set permissions**, choose **Attach policies directly**, select **AdministratorAccess**, and create the user.
4. Open the user, go to **Security credentials** > **Access keys**, and click **Create access key**. Choose **Other** as the use case and create the key.
5. In the Hosty container (`make cli`), save the key as a separate profile, and tell the tools of this shell to use it:

   ```bash
   aws configure --profile=hosty.temp
   export AWS_PROFILE=hosty.temp
   ```

   The container uses the profile `hosty.mfa` by default, which doesn't exist yet. `export` switches it only until you leave the shell.

## 2. Apply the blueprint

First, create `terraform/main.tf` from the template for new installs:

```bash
cp terraform/main.tf.example terraform/main.tf
```

The `main.tf` in the repository belongs to the install of SystemSeed, so replace it in your copy. The template is ready for this step: the `backend "s3"` block, the cluster and the projects are commented out, as the bucket for the state and the clusters don't exist yet. Fill in the values marked `<...>`:

- `hosted_zone_name` is your domain, and `default_region` is the AWS region for the shared resources.
- `users` has your username, and `administrators` has it too. Every administrator must also be in `users`.
- `alarms_webhook_url` and `alarms_email_address` say where alarms go.

Then apply it in the same shell of the container:

```bash
cd /src/terraform
tofu init
tofu apply
```

Check the plan and confirm it. The state is now in `terraform/terraform.tfstate`. It's the only record of what OpenTofu created, so don't delete it until step 4 moves it to S3.

## 3. Switch to your own user

Hosty created an IAM user for you, without a password or access keys. Set them up:

1. In the AWS Console, still as an admin, open **IAM** > **Users** > your user > **Security credentials**, and enable console access with a password.
2. Sign out, and sign in as your user.
3. On **Security credentials**, assign an MFA device and choose **Authenticator app**.
4. Sign out and sign in again, this time with a code from the app. Administrators can't do anything else without MFA, including creating access keys.
5. On **Security credentials**, click **Create access key**, choose **Other** and create the key.
6. Leave the container shell with `exit` so that `AWS_PROFILE` goes back to the default. Open a new one with `make cli`, save your key and start a session:

   ```bash
   aws configure --profile=hosty.user
   hosty auth
   ```

   `hosty auth` asks for a code from your authenticator app and starts a session that lasts 12 hours. Run it again when the session expires. Hosty CLI, OpenTofu, kubectl and Helm in the container all use this session (the profile `hosty.mfa`).

## 4. Move the state to S3

The blueprint created an S3 bucket, a DynamoDB table for locks and a KMS key for the state. Now move the state there.

1. Find the ID of the KMS key. Its alias is your domain with dots replaced by dashes, followed by `/terraform-state`. For `example.com`:

   ```bash
   aws kms describe-key --key-id alias/example-com/terraform-state --query KeyMetadata.KeyId --output text
   ```
2. In `terraform/main.tf`, uncomment the `backend "s3"` block and fill it in:

   ```hcl
   terraform {
     backend "s3" {
       bucket         = "tfstate.<hosted zone>"
       key            = "terraform.tfstate"
       encrypt        = true
       kms_key_id     = "<ID of the KMS key>"
       dynamodb_table = "tf-remote-state-lock"
       region         = "<default region>"
     }
   }
   ```
3. Move the state, and answer `yes` when OpenTofu asks to copy it:

   ```bash
   cd /src/terraform
   tofu init -migrate-state
   ```
4. Check that nothing is left to change:

   ```bash
   tofu plan
   ```

Once the plan is clean, you can delete the local `terraform.tfstate`.

## 5. Clean up

- **Delete the temporary user** in **IAM** > **Users**. Then remove the `[hosty.temp]` section from `~/.aws/credentials` and the `[profile hosty.temp]` section from `~/.aws/config` on your computer.
- **Point your domain to Route53.** Open **Route53** > **Hosted zones** > your domain, and copy the four name servers of its `NS` record. Set them at the registrar of the domain, or, for a subdomain like `hosting.example.com`, add them as an `NS` record in the DNS of the parent domain. Do this before you add projects: their certificates for development environments are validated through this zone, and `tofu apply` waits until they are issued.

## Next steps

1. [Add a cluster](https://wiki.systemseed.com/hosty/adding-a-new-cluster).
2. [Enable VPN-only access](https://wiki.systemseed.com/hosty/enabling-vpn-only-access) to the cluster.
3. [Add users](https://wiki.systemseed.com/hosty/adding-a-new-user) and [projects](https://wiki.systemseed.com/hosty/7xVm-adding-a-new-project).
