Skip to main content

AWS Cost Explorer operations

v0.1.11

Read-only AWS spend introspection — month-to-date by service, by account, forecast, and cost history over a trailing window by dimension. Auth via AWS_PROFILE with ce:* permissions. Cost Explorer must be enabled.

6 allowed by default
Pack ID
aws-cost
Vendor
emisar
OS
linux
Actions
6
Required binaries. Install these on the host before relying on the pack — an action that calls a missing one fails at run time.
aws

Install

emisar pack install fetches this pack, re-validates it, and verifies its content hash against the --hash below — the exact bytes this page was rendered against, so a tampered copy is rejected — before copying it into the runner's packs dir. The command reloads a running daemon itself; no manual restart.

on the runner host
sudo emisar pack install aws-cost --hash sha256:ec4df37627c83d1c6a765b84ae8fed698255ce2cc6386ed639c74744dd9ba466

Setup

Drives the aws CLI on the runner host. It resolves credentials from its own environment or ~/.aws config — the runner only forwards the variables you allowlist in inherit_env .

Environment

Set these on the runner host, then add each name to execution.inherit_env so the value reaches the action.

  • AWS_PROFILE

    Named profile in ~/.aws/config and ~/.aws/credentials . Omit to use the default profile or static-key/instance-role auth.

  • AWS_ACCESS_KEY_ID

    Static access key. Use instead of a profile; pair with AWS_SECRET_ACCESS_KEY .

  • AWS_SECRET_ACCESS_KEY

    Secret for AWS_ACCESS_KEY_ID .

  • AWS_SESSION_TOKEN

    Session token for temporary (STS) credentials.

Notes

  • An EC2 instance role or ECS task role needs no key at all and is the shape to prefer; a static pair is minted from the IAM users console → the user → Security credentials → Create access key.
  • Cost Explorer is a global service, so no region is required.
  • Cost Explorer must be enabled for the account, and the principal needs Cost Explorer read permissions (ce:GetCostAndUsage, ce:GetCostForecast, ce:GetSavingsPlansCoverage).
  • Alternative to env keys: an ~/.aws/credentials profile (read from disk, no inherit_env entry) or, on EC2/ECS, the instance/task role from instance metadata (no credentials needed at all).

Verify it works

Runs ce.mtd_by_service, a low-risk read that confirms the pack can reach its target. Run it on the host once the pack is installed; pack install runs it for you.

on the runner host
sudo emisar pack verify aws-cost

Install and configure a pack walks through the whole sequence on a host.

Actions 6 total

View on GitHub
  • ce.cost_history exec low Low — read-only or trivially reversible

    Cost over a trailing window by dimension

    Show cost over a trailing window of days ending today, grouped by one dimension at daily or monthly granularity. Cost Explorer serves 14 months of daily data and, once multi-year data is enabled, 38 months monthly; a window past what the account has enabled fails with the API's own error, so use MONTHLY beyond 14 months.

    View source on GitHub
  • ce.forecast_current_month exec low Low — read-only or trivially reversible

    Forecast current-month spend

    Show AWS-projected total spend for the current month based on usage so far.

    View source on GitHub
  • ce.last_7d_daily exec low Low — read-only or trivially reversible

    Last-7-day daily totals

    Show daily unblended cost for the last 7 days. Use to spot spend spikes.

    View source on GitHub
  • ce.mtd_by_account exec low Low — read-only or trivially reversible

    Month-to-date cost by linked account

    Show MTD cost grouped by linked account ID (org master account view).

    View source on GitHub
  • ce.mtd_by_service exec low Low — read-only or trivially reversible

    Month-to-date cost by service

    Show unblended cost from the 1st of this month until today, grouped by service.

    View source on GitHub
  • ce.savings_plans_coverage exec low Low — read-only or trivially reversible

    Savings Plans coverage (last month)

    Show what fraction of eligible compute spend was covered by Savings Plans / RI last month.

    View source on GitHub