AWS Cost Explorer operations
v0.1.11Read-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.
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.
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_PROFILENamed profile in
~/.aws/configand~/.aws/credentials. Omit to use the default profile or static-key/instance-role auth. -
AWS_ACCESS_KEY_IDStatic access key. Use instead of a profile; pair with
AWS_SECRET_ACCESS_KEY. -
AWS_SECRET_ACCESS_KEYSecret for
AWS_ACCESS_KEY_ID. -
AWS_SESSION_TOKENSession 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/credentialsprofile (read from disk, noinherit_enventry) 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.
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