tap-aws-cost-explorer
tap-aws-cost-explorer is a Singer tap for AWS Cost Explorer, built with the Meltano Singer SDK.
It extracts daily or monthly AWS costs, grouped by account, service, usage type, region, cost allocation tag or cost category. Run against an AWS Organizations management account, it covers every member account in the organization.
This is the MeltanoLabs variant, forked from albert-marrero/tap-aws-cost-explorer by Albert Marrero.
Installation
uv tool install meltanolabs-tap-aws-cost-explorer
Prerequisites
The tap needs AWS credentials that can call:
| Permission | Used by |
|---|---|
ce:GetCostAndUsage |
Every cost* stream |
organizations:ListAccounts |
The accounts stream |
To cover every account in an organization, use credentials (or role_arn) for the organization's management account. Cost Explorer there returns costs for every member account, split out by the LINKED_ACCOUNT dimension. Credentials for a member account only return that account's costs, and can't call organizations:ListAccounts, so deselect the accounts stream.
Cost Explorer API requests are billed by AWS, at $0.01 per request at the time of writing. The tap makes one request per page of results per stream, so each selected stream adds to the cost of a run.
Settings
| Setting | Required | Default | Description |
|---|---|---|---|
access_key |
AWS access key ID. Leave unset to use the default AWS credential chain (environment variables, shared config, or an instance or task role). | ||
secret_key |
AWS secret access key. | ||
session_token |
AWS session token, if the credentials are temporary. | ||
role_arn |
IAM role to assume before calling AWS. | ||
start_date |
Yes | First day of cost data to extract. Cost Explorer serves the last 14 months, or 38 months of monthly data if multi-year data is enabled. | |
end_date |
Today | Day to stop at, exclusive, so by default data runs to yesterday. | |
lookback_days |
3 |
Days before the bookmark to extract again on each run. | |
granularity |
DAILY |
DAILY or MONTHLY. |
|
metrics |
AmortizedCost, UnblendedCost, NetUnblendedCost, UsageQuantity |
Metrics to extract. Also available: BlendedCost, NetAmortizedCost and NormalizedUsageAmount. |
|
reports |
Extra cost reports; see Custom reports. |
A full list of settings and capabilities is available by running:
tap-aws-cost-explorer --about
Streams
| Stream | Grouped by | Primary key |
|---|---|---|
cost |
Nothing: total cost | time_period_start, metric_name |
cost_by_account_service |
linked_account, service |
time_period_start, linked_account, service, metric_name |
cost_by_account_usage_type |
linked_account, usage_type |
time_period_start, linked_account, usage_type, metric_name |
cost_by_account_region |
linked_account, region |
time_period_start, linked_account, region, metric_name |
cost_by_service_usage_type |
service, usage_type |
time_period_start, service, usage_type, metric_name |
accounts |
id |
Each cost* stream has one row per time period, group and metric:
| Field | Type | Description |
|---|---|---|
time_period_start |
date | First day of the period, and the replication key |
time_period_end |
date | Day after the last day of the period |
estimated |
boolean | Whether AWS still considers the amount an estimate |
| group columns | string | One column per group-by, e.g. linked_account and service |
metric_name |
string | The metric, e.g. UnblendedCost |
amount |
number | The amount |
amount_unit |
string | The unit, e.g. USD, or N/A for UsageQuantity |
The accounts stream lists the accounts in the organization, with their id, arn, email, name, state, status, joined_method and joined_timestamp. Join it to linked_account to name the accounts in cost reports.
Custom reports
Cost Explorer can group a query by at most two things, so each report is its own stream. Add a report for any other combination of dimensions, cost allocation tags (TAG) or cost categories (COST_CATEGORY):
config:
reports:
- name: cost_by_team
group_by:
- type: TAG
key: team
- type: DIMENSION
key: SERVICE
# Optional: a Cost Explorer filter expression, as in the GetCostAndUsage API.
filter:
Dimensions:
Key: RECORD_TYPE
Values: [Usage]
Group columns are named after the key in snake case, with tags prefixed tag_ and cost categories cost_category_, so this report has tag_team and service columns. Costs that aren't tagged or categorized have a null tag or cost category value. A tag must be activated as a cost allocation tag before Cost Explorer can group by it.
Incremental replication
Every cost* stream is incremental on time_period_start. Each run starts lookback_days before the bookmark, because AWS revises recent amounts as usage is processed and while a month's bill is finalized. Rows read again replace the earlier ones by primary key. With MONTHLY granularity, each run starts on the 1st of the month.
To backfill, reset the stream's state and set start_date to the first day you need, within the last 14 months.
Usage
You can run tap-aws-cost-explorer by itself or in a pipeline using Meltano.
tap-aws-cost-explorer --version
tap-aws-cost-explorer --help
tap-aws-cost-explorer --config CONFIG --discover > ./catalog.json
Developer resources
Initialize your development environment
uv sync
Create and run tests
The tests in tests/test_streams.py run against stubbed AWS responses. The standard SDK tests in tests/test_core.py call the live API, and run only when TAP_AWS_COST_EXPLORER_ACCESS_KEY and TAP_AWS_COST_EXPLORER_SECRET_KEY are set.
uv run pytest
Testing with Meltano
uv tool install meltano
meltano install
meltano invoke tap-aws-cost-explorer --version
meltano run tap-aws-cost-explorer target-jsonl
See the dev guide for more on how to use the SDK to develop taps and targets.
License
Metadata
Release files for meltanolabs-tap-aws-cost-explorer 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| meltanolabs_tap_aws_cost_explorer-0.1.0.tar.gz | 136.8 kB | With provenance | Details for meltanolabs_tap_aws_cost_explorer-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| meltanolabs_tap_aws_cost_explorer-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for meltanolabs_tap_aws_cost_explorer-0.1.0-py3-none-any.whl |
Total release size: 148.1 kB
Release files / meltanolabs_tap_aws_cost_explorer-0.1.0.tar.gz
| Download URL | meltanolabs_tap_aws_cost_explorer-0.1.0.tar.gz |
|---|---|
| Size | 136.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
891642be9f8d5ce6502bbc5f8d7f31d8bd565da424bad3e49dbf96ee7fb3040b
|
|
BLAKE2b-256 checksum How to use checksums |
fd6efc204110a4b05090d676f1e64cfe81ec91e46a1a9a3fd4ea6ed7165513ef
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.
Transparency logRelease files / meltanolabs_tap_aws_cost_explorer-0.1.0-py3-none-any.whl
| Download URL | meltanolabs_tap_aws_cost_explorer-0.1.0-py3-none-any.whl |
|---|---|
| Size | 11.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c6d4a7c1af27f8213f59d13dc4444e32cb25d19cd62ac3384815bb764abcf330
|
|
BLAKE2b-256 checksum How to use checksums |
15999c58c537a7839aff97e98ab5fd478f2457e3ee8775d49d0facd25968178c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.
Transparency logSecurity for meltanolabs-tap-aws-cost-explorer 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for meltanolabs_tap_aws_cost_explorer-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.