Skip to main content

Aviv AWS CostExplorer

Aims to provide a quick and comprehensive interface to AWS costexplorer api. This is useful to extract cost and usage (aka CAU) data, save it and to make it available for reporting and analysis.

Requirements

  • python >= 3.8
  • boto3
  • Access to AWS ce:cost_and_usage

Usage

pip install aviv-aws-costexplorer

# Install additional libraries required to save/read data on AWS S3: pandas, awswrangler
pip install aviv-aws-costexplorer[datastore]

Sample code

from aviv_aws_costexplorer import costreporter

cr = costreporter.CostReporter()
costs = cr.get_cost_and_usage()
# Will print you last 3 months costs
print(costs)

from aviv_aws_costexplorer import datastore
ds = datastore.DataStore(database='test', bucket='my-s3-bucket')
ds.to_parquet(data=costs, path='monthly/last3', database='monthly')

# Show it nicely
import pandas as pd
df = pd.DataFrame(costs)
df.head()


# Store on S3 and make it available through Athena (uses awswrangler)

Development

pipenv install -d

Test, Build, Release

We typically follow the standard python packaging and distribution process to release this package.

# Run tests
pipenv run pytest -v tests/

# Build python package
python3 -m pip install --upgrade build
python3 -m build

# Release on testpypi
python3 -m pip install --upgrade twine
python3 -m twine upload --repository testpypi dist/*

Note: the Pypi release is also done during the CICD process.

Contribute

Yes please! Send us your PR's

Metadata

Release files for aviv-aws-costexplorer 0.2.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aviv-aws-costexplorer 0.2.3
File Size Uploaded Provenance
aviv-aws-costexplorer-0.2.3.tar.gz 12.4 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for aviv-aws-costexplorer 0.2.3
File Interpreter ABI Platform
aviv_aws_costexplorer-0.2.3-py3-none-any.whl Python 3 none any Details

Total release size: 27.2 kB

Release files / aviv-aws-costexplorer-0.2.3.tar.gz

Download URL aviv-aws-costexplorer-0.2.3.tar.gz
Size 12.4 kB
Tags Source
SHA-256 checksum
How to use checksums
f718b4656c1fcd9e87f224932840aad9c8f022fe0b29d51d1e99502dab9a12af
BLAKE2b-256 checksum
How to use checksums
41cf3ea82dfd91f2ae8f5ff7689084b38674cafb885761dcf6a9d4bcb88cbb7a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.0 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.10

Release files / aviv_aws_costexplorer-0.2.3-py3-none-any.whl

Download URL aviv_aws_costexplorer-0.2.3-py3-none-any.whl
Size 14.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a9ddcc9bf2ef27652baf164f509ed569207f681588d0e5e59e38b3dda41a5bd8
BLAKE2b-256 checksum
How to use checksums
3fb313dd24d83aeb5afa7421d046cd4ef1e289c7ec0fa5f888782f263837d6cf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.0 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.10

Security for aviv-aws-costexplorer 0.2.3

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page