Docs
Router
A router naps and wakes the workloads of one AWS account or Google Cloud project, in one region.
9 min read
What the install creates
AWS
- By: the manager, as the command role (Roles), in no stack or Terraform state.
- Its name:
dmtr-<env>-<region>in the manager's own account,dmtr-<env>-<account>-<region>in another. - Its roles:
dmtr-<env>-<region>-controller,dmtr-<env>-<region>-waker,dmtr-<env>-<region>-scheduleranddmtr-<env>-<region>-onboarder, under the path/dormeto/router/, each with the boundaryDmtRouterBoundary(Roles). - Its functions: the Lambda functions
dmtr-<env>-controller,dmtr-<env>-wakeranddmtr-<env>-onboarder, their logs under/aws/lambda/kept 14 days. - Its state: the DynamoDB table
dmtr-<env>-router, with point-in-time recovery. - Its queues:
dmtr-<env>-work,dmtr-<env>-drift,dmtr-<env>-check-failuresanddmtr-<env>-controller-failures. - Its triggers: the EventBridge Scheduler schedule
dmtr-<env>-check, the idle check every 5 minutes. The EventBridge ruledmtr-<env>-driftrepairs outside changes. - Its access to EKS: its roles' access entries, the proxy function
dmtr-<env>-kube-<cluster>per private cluster (Kubernetes). - Your Terraform: it must ignore what onboarding changes (Workloads).
Google Cloud
- By: the CLI, as you, once you confirm its plan of every IAM change (Access).
- Its name:
dmtr-<region>in its project (CLI). - In the project: the APIs, the custom roles
dormetoRouteranddormetoRouterBackends(Roles), the secure tagdormeto=managed. - Its service account:
dmtr-<region>@<project>.iam.gserviceaccount.com, the only identity of its services and tasks (Roles). - Its state: the Firestore database
dmtr-<region>, which holds the install record, and the Cloud Tasks queuedmtr-<region>. - Its log view:
dmtr-<region>-lb, on the project's_Defaultbucket (Request logs). - The router, unless
--access-only: the Cloud Run servicesdmtr-<region>-wakeranddmtr-<region>-controller, from its image. Its network endpoint groupdmtr-<region>-waker, and the Cloud Scheduler jobdmtr-<region>-checkevery 5 minutes. - Its optional access: Cloud SQL's and GKE's, when you ask (Optional access).
- Your Terraform: it must ignore what onboarding changes (Workloads).
Install
AWS
- Give the account the command role (Access).
- Install it from Routers, Install a router, with the account's ID and region, as an administrator. Or with the CLI, which follows the operation to its end:
dormeto aws routers install --account 111122223333 --router-region eu-west-3 - Follow its steps in Operations.
- An onboarding where no router runs installs one first, in the same operation.
- The router is the manager's release's (Releases). Routers offers to upgrade an older one, as
dormeto aws routers upgradedoes. - A router written in Terraform is upgraded and removed by that Terraform: the manager refuses to.
Google Cloud
- Check your permissions (Check).
- Install it with your
gcloudaccount:dormeto gcp routers install --project my-project --region europe-west1
- A later run upgrades it to the CLI's version (The router's image).
Capacity and fallback types
A start refused for lack of capacity is retried within the wake.
- The retries come after 30 s, 60 s, then every 120 s, until the wake's deadline.
- Fallback types give a machine up to 5 other types for such a wake, in order (Workloads). Databases have none.
- At its next stop, the machine gets its own type back; a failure is logged
InstanceTypeNotReverted. - A hibernated or suspended machine wakes on its own type, with the retries only.
AWS
- Retried: an EC2 or RDS start. Auto Scaling and ECS keep trying on their own.
- Fallback instance types: EC2 instances only, such as
m6i.large, m5.large, t3a.large. - In Terraform: the workload module's
fallback_instance_types. - What you see: the workload's page says On fallback instance types.
Google Cloud
- Retried: a VM's or managed group's start or resume, on
ZONE_RESOURCE_POOL_EXHAUSTEDorPOOL_CAPACITY_INSUFFICIENT, not a quota error. - Fallback machine types: such as
e2-medium, for VMs of unmanaged and zonal network endpoint groups. - Refused: managed groups, pods, a type the VM's zone lacks, local SSDs and GPUs (Eligibility).
- Another series: both must be among N1, F1, G1, N2, N2D, E2, C2, C2D, M1, M2 and T2D.
- After the onboarding: the list can't change. An offboarding names a VM still on a fallback type, which keeps it.
- What you see: each VM's type in the run's
instanceTypes, the logInstanceTypeFallbackanddormeto gcp workloads show. The workload's page and the offboarding sayfallbacks.
| Message | Cause | Fix |
|---|---|---|
the router's role lacks compute.instances.setMachineType: run dormeto gcp routers install again Google Cloud only | Its role lacks compute.instances.setMachineType. | Run the install again. |
Features
Optional access Google Cloud only
Cloud SQL and GKE each need their own roles, asked by name.
dormeto gcp routers install --with cloud-sql,gke
- Each API brings Google's agents: none for
cloud-sql, two agents and six APIs forgke(Roles). - The install record keeps each feature until the uninstall.
- The CLI's next run prints any binding Google added.
Databases
Companion databases stop after the application, and start before it.
- The router starts and stops only those the onboarding tagged.
AWS
- RDS instances and Aurora clusters, given at the onboarding (Workloads).
- The onboarding tags them
dormeto:workload.
Google Cloud
- Primary Cloud SQL instances of the project, with the access
cloud-sqland its APIsqladmin.googleapis.com. - The onboarding tags them
dormeto=managed.
Kubernetes
Deployments and StatefulSets, scaled to zero by a nap.
AWS
- Of the EKS clusters in the router's account and region.
- Its access entries, a private cluster's proxy and the rights inside, from the release's manifest: Access.
Google Cloud
- Behind standalone network endpoint groups, on your load balancer, with the access
gkeand its APIcontainer.googleapis.com. - The CLI reads the cluster as you, then shows and asks. It applies, in the workload's namespace, a
Roleand aRoleBindingdormeto-<workload>:getondeployments,statefulsets.listonreplicasets.patchondeployments/scale,statefulsets/scale.listonpods,events.list,patchonscaledobjects.
- The offboarding removes both.
- You need
container.roles.escalateandcontainer.roles.bind; Google markscontainer.roles.escalateasTESTINGin custom roles.
IP lists
IP lists keep listed addresses, such as scanners, from waking workloads.
AWS
- They are the manager's: the
ip_listsof its module, each with its action (Manager). - A router the manager installed reads them; a change reaches it within 5 minutes.
Google Cloud
- They are the router's own, set at its install (routers).
- The action is
ignoreonly. - A listed visit never wakes; an API client's
POST /_dormeto/wakestill does. - The manager's lists don't reach a Google Cloud router; its own need no extra role.
- A list's URL, query string included, is printed and stored: keep tokens out. One with credentials is refused.
- Behind a
globalorclassicload balancer, a forged header can't change the client's address.
Check
AWS
dormeto aws routers show dmtr-prod-eu-west-3
- Before the install: Discovery's check of the command role (Access).
- Once installed: its health,
ok,warningorerror, with its problems. - Where: Routers and
dormeto aws routers list;routers showprints each problem (routers). - An error: a late idle check, so the workloads no longer nap on their own.
- A warning: any other problem: a failure queue's messages, Lambda errors, a failing IP list or workload.
- Its EKS clusters: the router's page under Routers lists them, and whether it reaches them (Access).
- Alerts: a router that reports a problem, or stops reporting, alerts the addresses of
alert_emails(Manager).
Google Cloud
dormeto gcp check --project my-project --region europe-west1
- Before the install:
dormeto gcp checkreads your permissions and changes nothing. - Per command: a tick, or a cross with the missing permissions, all of them with no role.
- Also: the project's parent and billing, the APIs on, and warnings such as the default service account's Editor.
- Its exit: 1 when a permission or billing is missing.
- Once installed:
dormeto gcp routers showshows the record and the live state: version, services, controller health, queue, job, database, grants.
Remove
The uninstall refuses a router with workloads.
AWS
- Offboard its workloads first.
- Uninstall it from its row's ⋮ on Routers, or from the router's page, as an administrator. Or with the CLI, which asks first:
dormeto aws routers uninstall dmtr-prod-eu-west-3
- The uninstall deletes its EKS access entries. And private clusters' proxies, with their TCP 443 rule on the cluster's security group.
- The account keeps its access: the command role, its boundary and the discovery role (Access).
Google Cloud
- Offboard its workloads first, or uninstall with
--force(routers). - Uninstall it:
dormeto gcp routers uninstall --project my-project --region europe-west1 - Turn off the APIs nothing else needs (The APIs).
- Remove the default service account's Editor (Roles).
- It removes what its record says the install added, in reverse order, optional access included.
- It keeps the custom roles and the tag while another router of the project lists them.
- It names the APIs and Google's bindings it leaves on.
- A deleted queue's name stays blocked up to 3 days, a database's ID about 5 minutes. Installing again before fails.
The APIs Google Cloud only
The install turns these on.
| API | Service |
|---|---|
compute.googleapis.com | Compute Engine |
run.googleapis.com | Cloud Run |
firestore.googleapis.com | Firestore |
cloudtasks.googleapis.com | Cloud Tasks |
cloudscheduler.googleapis.com | Cloud Scheduler |
monitoring.googleapis.com | Cloud Monitoring |
artifactregistry.googleapis.com | Artifact Registry, with --image only. |
iam.googleapis.com | Identity and Access Management |
cloudresourcemanager.googleapis.com | Cloud Resource Manager |
logging.googleapis.com | Cloud Logging |
With the optional access, also sqladmin.googleapis.com, container.googleapis.com and the six Google turns on with GKE (Roles).
To turn them off:
gcloud services disable \
compute.googleapis.com \
run.googleapis.com \
firestore.googleapis.com \
cloudtasks.googleapis.com \
cloudscheduler.googleapis.com \
monitoring.googleapis.com \
artifactregistry.googleapis.com \
iam.googleapis.com \
cloudresourcemanager.googleapis.com \
logging.googleapis.com \
--project my-project
Google may refuse while another service depends on one, or ask for --force.
The router's image Google Cloud only
The install deploys Dormeto's public image, in the multi-region of --region.
<europe|us|asia>-docker.pkg.dev/dormeto-releases/router/router:<version>
- The multi-region:
europeforeurope-*,usforus-*,northamerica-*andsouthamerica-*,asiafor any other. - A later run: it upgrades an older router to the CLI's default version.
- By digest: the CLI deploys
<name>@sha256:…, read without a token; you build, push and grant nothing. - An access-only record: it says
accessOnly, and later runs keep it until one gives--versionor--image. - Your own image: it stays for later runs. It needs
artifactregistry.googleapis.comand your permissions on it (Roles).dormeto gcp check --imagetests them. - An image in another project: it needs
roles/artifactregistry.readerfor this project's Cloud Run service agent (Roles). You grant it: the CLI doesn't.
| Message | Cause | Fix |
|---|---|---|
router <v> needs a newer CLI: brew upgrade dormeto | --version above this CLI's own. | Upgrade the CLI. |
router <v> is newer than this CLI knows (<default>): brew upgrade dormeto | A newer CLI installed the router. | Upgrade the CLI. |
the router isn't installed: dormeto gcp routers install --version <default> | The record holds the access only. | Install the router with --version. |
router <v> is available: dormeto gcp routers install --version <v> | Your own image stays; Dormeto's is at <v>. | Install it with --version, or keep yours. |
--ip-list and --access-only: one or the other | IP lists need the router. | Drop one of the two options. |
the install removes no router: dormeto gcp routers uninstall removes it with its access | --access-only on an installed router. | Uninstall the router instead. |
Request logs Google Cloud only
The idle check counts every request the load balancer served, scanners included.
With the request logs, it ignores what the waker ignores: HEAD requests, scanners and IP lists.
- They need the backend service to log every request: logging on, sample rate 1.0.
dormeto gcp workloads onboard --request-logsturns it on (workloads). - Terraform keeps them only if you write them (Workloads).
- Scanners that send a browser's user agent to the application's own paths count as visitors. IP lists stop known scanner networks.
- On a regional load balancer, logging begins a few minutes after the change.
- The router reads only its view
dmtr-<region>-lb, of the load balancers' request logs, withroles/logging.viewAccessor(Roles). - Cloud Logging charges ingestion past 50 GiB a month and project, about 1 KiB a request.
| Message | Cause | Fix |
|---|---|---|
the router's log view isn't created: the project's _Default log bucket isn't in global; the idle check counts every request | The project's _Default bucket isn't in global, where the view lives. | Accept it: dormeto gcp routers show repeats it, and a later run tries again. |