Skip to content

Survey what runs on AWS

$ grim infra:list --check

Some weeks after a run of wizards you no longer remember what is still out there, and everything that is out there is on the bill. grim infra:list answers from the records the wizards left on your machine: what was made, where, and roughly what it costs a month. It is also where you look up the id before you remove something.

Usage

$ grim infra:list                     # what grim has on record, no AWS calls
$ grim infra:list --check             # also ask AWS whether each instance still exists
$ grim infra:list --check --profile=acme

Run it from anywhere. The plain form reads ~/.grim/servers.json and works offline. --check needs the aws CLI and credentials that can describe instances.

Arguments and options

List grim-managed cloud servers with cost estimates

Usage

grim infra:list [--check] [--profile PROFILE]

Options

Option Description
--check Verify each instance still exists in AWS (extra API calls)
--profile=PROFILE AWS CLI profile to use for --check

What it actually does

  1. Reads ~/.grim/servers.json. Servers count when their infra block says grim made them. A server you registered by hand with grim server:setup is not listed here.
  2. Prints the SERVERS table. Alias, provider, region, IP, instance type, estimated cost a month, and state.
  3. Prints the AWS RESOURCES table. Id, type, region, cost, a detail column and state. The detail is the scope of a bucket, the preset of a trail, the instance of an alarm set, or the limit of a budget.
  4. Dates the prices. The last line names the snapshot the estimates come from.

With nothing on record it says No grim-managed infrastructure found. and names the commands that create something.

Reading the STATE column

State Shown Meaning
tracked Without --check, and always for AWS resources grim has a record. Nobody asked AWS.
running With --check AWS confirms the instance is up.
stopped, or another AWS state With --check The instance exists and is not running. A stopped instance still pays for its disk and its address.
missing With --check The call returned no instance. Either it was terminated outside grim, or the call itself failed.

--check uses the profile saved with each server, so servers in several accounts are checked in one run. --profile overrides it for every row. Buckets, trails, alarms and budgets are never verified.

missing is also what an expired login or the wrong profile looks like, because any failed call reads as no instance. Before you believe it, run grim infra:doctor --profile=<profile> and check again.

About the costs

The numbers are estimates from a price snapshot built into grim, for the instance type and disk on record plus assumed traffic. A bucket is priced as a small bucket whatever it holds, and a budget is $0.00. A region the snapshot does not cover shows -. Read the column as an order of magnitude and the AWS billing console as the truth.

After it finishes

The first column is what the other commands take: an alias for grim infra:dns, an alias or a resource id for grim infra:destroy.

$ grim infra:destroy alarms-i-0abc1234def567890

A server that is truly missing is a record with little behind it. grim infra:destroy <alias> has Terraform remove whatever is left of the stack, such as the address and the firewall, and then tidies the record away.