Applying Hosty blueprint
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.

What you need
- 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
- In the AWS Console, open IAM > Users and click Create user.
- Enter any name, for example temp.admin. You don't need console access for it.
- On Set permissions, choose Attach policies directly, select AdministratorAccess, and create the user.
- Open the user, go to Security credentials > Access keys, and click Create access key. Choose Other as the use case and create the key.
- In the Hosty container (make cli), save the key as a separate profile, and tell the tools of this shell to use it:
aws configure --profile=hosty.temp
export AWS_PROFILE=hosty.tempThe 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:
cp terraform/main.tf.example terraform/main.tfThe 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:
cd /src/terraform
tofu init
tofu applyCheck 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:
- In the AWS Console, still as an admin, open IAM > Users > your user > Security credentials, and enable console access with a password.
- Sign out, and sign in as your user.
- On Security credentials, assign an MFA device and choose Authenticator app.
- 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.
- On Security credentials, click Create access key, choose Other and create the key.
- 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:
aws configure --profile=hosty.user
hosty authhosty 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.
- Find the ID of the KMS key. Its alias is your domain with dots replaced by dashes, followed by /terraform-state. For example.com:
aws kms describe-key --key-id alias/example-com/terraform-state --query KeyMetadata.KeyId --output text- In terraform/main.tf, uncomment the backend "s3" block and fill it in:
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>"
}
}- Move the state, and answer yes when OpenTofu asks to copy it:
cd /src/terraform
tofu init -migrate-state- Check that nothing is left to change:
tofu planOnce 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
- Enable VPN-only access to the cluster.