# maws

> maws: the resources in an AWS account, their cost per hour and the bill so far, shown in one terminal screen. Written in Mojo.

The resources in an AWS account, their cost per hour and the bill so far this month, shown in one terminal screen. Written in Mojo.

[GitHub](https://github.com/magmalake/maws) [Releases](https://github.com/magmalake/maws/releases)

[![The maws terminal UI: an account header, the burn rate per hour and per day, month-to-date and projected spend, a table of EC2 instances, NAT gateways, EBS volumes and Elastic IPs with their hourly cost, and the month-to-date bill by service.](https://magmalake.dev/s/maws/maws-tui.svg)](https://magmalake.dev/s/maws/maws-tui.svg)

Sample data, rendered by maws's own formatting code.

### What it shows

- **$/hr** for every running EC2 instance, EBS volume, NAT gateway and public IPv4 address, at the on-demand list price from the AWS Pricing API.
- **Month-to-date** from Cost Explorer, by service, cached for an hour, since every call is billed at $0.01\.
- **Projected**: month-to-date plus the current burn for the rest of the month.
- The account name and ID, so a $0 for the wrong account is obvious.

### How it is built

- No AWS SDK and no C shim: requests are signed with [sigv4.mojo](https://github.com/magmalake/sigv4.mojo), EC2's XML is read with [xml.mojo](https://github.com/magmalake/xml.mojo), and libcurl is called directly from Mojo.
- Credentials from the environment, `~/.aws/credentials`, or the AWS CLI for `aws login`, SSO and role profiles.
- A Python reference (boto3 + Textual) in the same repository, held to the same numbers.

### Install

On macOS arm64 or Linux x64, use the install script. Read it first: it downloads the latest release, checks its SHA-256 against the published checksum, unpacks it to `~/.local/share/maws` and links `~/.local/bin/maws`. No sudo.

```
curl -fsSL https://raw.githubusercontent.com/magmalake/maws/main/install.sh | less
```

Once you have read it:

```
curl -fsSL https://raw.githubusercontent.com/magmalake/maws/main/install.sh | bash
```

Then run `maws`, or `maws --profile <name>` for another AWS profile.

Or download a tarball and its `.sha256` from the [releases page](https://github.com/magmalake/maws/releases) yourself.
