Dormeto
ENFR

Getting started

Get started

The Dormeto manager runs in your AWS account. It holds the dashboard and API, and discovers your load balancers. It installs the routers where workloads nap. You install it from a versioned release. Use the dormeto CLI, which runs Terraform for you in your account, or your own Terraform. It never uses CloudFormation.

9 min readManager 0.21.0

Estimate first

Before you install anything, dormeto aws estimate reads your accounts and tells you what Dormeto would save. It shows which workloads sit idle, for how long, and what their naps are worth. Install the command line with one of:

brew install dormeto/tap/dormeto
curl -fsSL https://dormeto.com/install.sh | sh

Homebrew and the script install the same program. The script checks the download's SHA-256, installs into ~/.local/bin and never uses sudo. On Windows, download dormeto_<version>_windows_amd64.zip from the latest release, unzip it and put dormeto.exe in a folder of your PATH. Then one command:

dormeto aws estimate --profile <profile> --uptime

It is read-only. It only lists and reads (load balancers, instances, services, metrics, prices), and writes a report on your machine. Nothing is sent but to AWS (and to your clusters' own APIs). There is no telemetry and no update check. The options (organizations, regions, reports) are in the Dormeto/cli repository.

Prerequisites

  • Administrator credentials of the account where the manager runs, in its region.
  • An AWS organization. The manager lists its accounts through a delegation policy of the management account. It reads each account through a role there (Organization access). A single account outside any organization works too. The CLI suggests it. With Terraform, you set discovery_mode = "account" and leave out organization_id.
  • Optional: a domain for the dashboard, and its Route 53 zone. Its certificate is in us-east-1 and covers the dashboard host and auth. under it. Without, the dashboard is on a cloudfront.net host.
  • Optional: a verified SES identity to send the invitations. Without, Cognito sends them itself (about 50 a day).
Roles first, or after

The roles in your other accounts can be created before or after the manager. It checks them at each discovery run and says what is missing (Organization access).

Install

Two ways to install the same manager from the same release. The dormeto CLI is the simpler one: it asks what it needs, checks it, and runs Terraform for you in your account. There is nothing else to install and no Terraform state to keep. With your own Terraform, the manager is a module in a configuration you keep.

With the dormeto CLI Recommended

How the dormeto CLI installs the managerYOUR AWS ACCOUNT · THE MANAGER'S REGIONTHE MANAGERdashboardAPIsign-infunctionstablerolesreleases.dormeto.comthe release, checkedreleases.hashicorp.comTerraform, checkeddmt-<env>-installCodeBuild: plan, then applydmt-install-…answers, state, plans›dormeto aws installyour laptop123456
  1. It asks what it needs, then checks your account, read-only.
  2. It creates the install bucket and the CodeBuild project.
  3. A first build downloads the release and Terraform, checks them, and saves the plan.
  4. The CLI shows the plan. You confirm.
  5. A second build applies exactly that plan: the manager is created.
  6. The CLI checks that the dashboard answers. Each administrator gets an invitation.

The command you installed to estimate (Estimate first) installs the manager too, with administrator rights in the manager's account:

aws sso login --profile <profile>
dormeto aws install --profile <profile>

# without a terminal: every answer as a flag; it stops after the plan, then apply that plan
dormeto aws install --profile <profile> --admin-emails you@example.com
dormeto aws install apply --profile <profile>

--management-profile <profile> also sets up organization access. Every flag: Install the manager.

With your own Terraform

How your Terraform installs the managerYOUR AWS ACCOUNT · THE MANAGER'S REGIONTHE MANAGERdashboardAPIsign-infunctionstablerolesreleases.dormeto.comthe module and its built code›terraform plan · applyyour machine or CIYour state backendS3, or the one you use123456
  1. terraform init downloads the module from the release.
  2. terraform plan -out reads your account and saves the plan.
  3. You read the plan.
  4. terraform apply applies that saved plan: the manager is created by AWS API calls.
  5. The state is saved in your backend.
  6. You open the dashboard_url output. Each administrator gets an invitation.

Terraform 1.9 or later, with administrator credentials of the account where the manager runs. In a Terraform configuration of your own, with the state backend you use:

provider "aws" {
  region = "eu-west-1"
}

module "dormeto" {
  source          = "https://releases.dormeto.com/manager/0.21.0/terraform-aws-dormeto-0.21.0.zip//modules/manager"
  env             = "prod"
  organization_id = "o-exampleorgid"
  admin_emails    = ["you@example.com"]
}

output "dashboard_url" {
  value = module.dormeto.dashboard_url
}
terraform init
terraform plan -out=dormeto.tfplan
terraform apply dormeto.tfplan

The release carries the manager's built code and the router it installs. Nothing else is fetched at plan or apply time. Its files and their SHA-256 checksums are listed in SHA256SUMS. The latest version is named in latest.json. Every input of the module: Configuration.

A custom domain and SES

  domain = {
    dashboard       = "dormeto.example.com"
    auth            = "auth.dormeto.example.com"
    certificate_arn = "arn:aws:acm:us-east-1:111122223333:certificate/…"
    zone_id         = "Z0123456789ABCDEFGHIJ"
  }
  ses_identity = "example.com"
  email_from   = "Dormeto <no-reply@example.com>"

Organization access

The manager's own account gets its roles from the module. Every other account to discover gets DmtDiscoveryRole. Every account where workloads nap gets DmtCommandRole. They come from the access module or the AWS CLI script of the same release, or from dormeto aws install with --management-profile. The management account gets the delegation policy: Organization access. Workloads on EKS also need Dormeto's rights in their cluster: Kubernetes.

First sign-in

Each address of admin_emails receives an invitation with a temporary password, valid 7 days. Open dashboard_url, sign in, choose a password, and add a second factor if you wish. In Discovery, Run now reads your organization. The Organization access panel lists the accounts whose roles are missing.

Event-driven refresh

Discovery runs on its refresh period (daily by default). In Discovery, the Perimeter settings can turn on event-driven refresh. The manager then installs a forwarder in each account with the command role and a CloudTrail trail. Load balancer changes appear within about 5 minutes. Turned off, the forwarders are removed at the next run.

Updating the manager

Three ways to move the manager to a newer release, each showing the plan before it applies it. The CLI and the dashboard update a manager installed with the CLI. Your own Terraform updates the one it installed.

With the dormeto CLI Recommended

How the dormeto CLI updates the managerYOUR AWS ACCOUNT · THE MANAGER'S REGIONTHE MANAGERdashboardAPIsign-infunctionstablerolesreleases.dormeto.comthe release, checkedreleases.hashicorp.comTerraform, checkeddmt-<env>-installCodeBuild: plan, then applydmt-install-…answers, state, plans›dormeto aws installyour laptop123456
  1. dormeto aws install reads the answers of your last run in the install bucket.
  2. It checks your account and the release, read-only.
  3. A first build downloads the new release and Terraform, checks them, and saves the plan.
  4. The CLI shows what changes. You confirm.
  5. A second build applies exactly that plan: the manager is updated.
  6. You open the dashboard, in the new version. Its Routers view offers the router upgrades.

Run the install again: it reuses your answers, then shows the plan to confirm.

dormeto aws install --profile <profile>                       # the latest release
dormeto aws install --profile <profile> --version <version>

--tag key=value tags the manager's resources (CLI 0.3.0 and later). --management-profile applies organization access again.

With your own Terraform

How your Terraform updates the managerYOUR AWS ACCOUNT · THE MANAGER'S REGIONTHE MANAGERdashboardAPIsign-infunctionstablerolesreleases.dormeto.comthe module and its built code›terraform plan · applyyour machine or CIYour state backendS3, or the one you use123456
  1. You change the version in source, twice: the path and the file name.
  2. terraform init downloads the new module from the release.
  3. terraform plan -out reads your account and saves the plan.
  4. You read what changes.
  5. terraform apply applies that plan: the manager is updated, the state saved in your backend.
  6. You open the dashboard, in the new version. Its Routers view offers the router upgrades.

Change the version in source, twice: the path and the file name. Then:

terraform init
terraform plan -out=dormeto.tfplan
terraform apply dormeto.tfplan

To update from the CLI or the dashboard instead, the CLI can take this install over: Adopting a manager installed with Terraform.

From the dashboard After a CLI install

How the dashboard updates the managerYOUR AWS ACCOUNT · THE MANAGER'S REGIONTHE MANAGERdashboardAPIsign-infunctionstablerolesreleases.dormeto.comthe release, checkedreleases.hashicorp.comTerraform, checkeddmt-<env>-installCodeBuild: plan, then applyEventBridge rulestarts the builddmt-install-…requests, state, plansUpdate pagean administrator123456
  1. On the Update page, an administrator picks a version, reads its notes, and chooses Prepare.
  2. The manager's API drops a request in the install bucket.
  3. An EventBridge rule starts the install build.
  4. The build checks the request, downloads the release and Terraform, and saves the plan.
  5. The page shows what changes. Confirm sends a second request.
  6. A second build applies exactly that plan. The page follows it to the end.

It takes a manager 0.12.0 or later, installed with dormeto aws install (CLI 0.2.0 or later). Administrators open Update, pick a version, then choose Prepare and Confirm. The same page can check daily for new versions.

Read the release's Access line

An update changes the manager only, with the settings last applied. When a release asks for it on Releases, apply the member accounts' access again: Organization access.

The manager then offers, in its Routers view, the router upgrades the release carries.

Routers and workloads from the CLI

This needs the CLI 0.4.0 or later and a manager 0.15.0 or later. keep-awake and resume below need CLI 0.5.0. List the routers and workloads and upgrade routers from your laptop, with the AWS profile you installed with:

dormeto aws routers list --outdated
dormeto aws workloads list --tag team=payments --state ASLEEP
dormeto aws routers upgrade --tag team=payments    # or --all; --dry-run prints the plan only

routers upgrade prints the plan, with the routers it skips and why (written in Terraform, up to date, busy with an operation). It asks you to confirm. --yes is needed without a terminal, and --json prints the result for a script. --tag key=value selects the routers that serve a workload with these Dormeto tags.

To keep workloads awake, for example around a CI job, and to set schedules (Schedules):

dormeto aws workloads keep-awake prod-eu/w-1 --for 1h --wait
dormeto aws workloads resume prod-eu/w-1
dormeto aws workloads schedule set --tag team=payments --file schedule.json

keep-awake wakes the workload if it is asleep and keeps it from napping for up to 7 days (--for or --until). --wait returns once it is awake, so a CI step can go on, and resume ends it. keep-awake and resume need CLI 0.5.0 and any manager 0.15.0 or later. Schedules need CLI 0.5.0, manager 0.16.0 and routers 0.31.0. --tag selects every workload with these tags.

The caller needs execute-api:Invoke on the manager API’s /iam/* routes, in the manager’s account. They are the api_iam_arn output of the module, and GET alone is enough for the two lists. The caller also needs apigateway:GET to find the API by name, unless --api-url is given. Such a caller acts as an administrator: the audit and the operations name its ARN.

CLI 0.6.0 has a command for every other operation of the manager too: onboarding, discovery, operations, users and groups, the audit, the manager’s update. They are on the CLI page, with IAM policies from read-only to every route.

Uninstall

  1. In the manager, offboard the workloads and uninstall the routers. They were installed by API calls, outside your Terraform state. If event-driven refresh is on, turn it off and run discovery (Run now). The forwarders it installed in your accounts are then removed.
  2. Set deletion_protection = false in the module (it protects the users from a mistaken destroy), apply, then terraform destroy.
  3. Remove the roles of the member accounts and Dormeto's statement of the delegation policy, keeping its others: Organization access.
In this order

Destroying the manager first leaves the workloads awake and their rules as they were. The routers are then left to remove by hand.