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=acmeRun 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
- Reads
~/.grim/servers.json. Servers count when theirinfrablock says grim made them. A server you registered by hand withgrim server:setupis not listed here. - Prints the SERVERS table. Alias, provider, region, IP, instance type, estimated cost a month, and state.
- 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.
- 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-0abc1234def567890A 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.
Related spells
grim infra:dns
Point a domain at a server
Print the two DNS records that point a domain at a server, with step-by-step instructions for Cloudflare or Route 53, and check whether they are live yet.
grim infra:doctor
Check the way to AWS
Check that the aws CLI, terraform and working AWS credentials are in place, and print the setup steps for whatever is missing.
grim infra:destroy
Unmake what grim made
Remove a server or AWS resource that grim created, after checking the account and making you type its name, and stop it from being billed.
grim infra:aws-ec2
Raise a server on AWS
Create one EC2 instance with a static address, a firewall and your SSH key in your AWS account, then hand it to grim server:setup.
grim server:status
Look over a server
List the servers you have registered, or look at one of them: its containers, its disk, Traefik and its projects.