Skip to main content

Aviv AWS CostExplorer python library

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aviv-aws-costexplorer-0.2.3.tar.gz (12.4 kB view details)

Uploaded Source

Built Distribution

aviv_aws_costexplorer-0.2.3-py3-none-any.whl (14.8 kB view details)

Uploaded Python 3

File details

Details for the file aviv-aws-costexplorer-0.2.3.tar.gz.

File metadata

  • Download URL: aviv-aws-costexplorer-0.2.3.tar.gz
  • Upload date:
  • Size: 12.4 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for aviv-aws-costexplorer-0.2.3.tar.gz
Algorithm Hash digest
SHA256 f718b4656c1fcd9e87f224932840aad9c8f022fe0b29d51d1e99502dab9a12af
MD5 62f00b0499888dc564267cd5770076af
BLAKE2b-256 41cf3ea82dfd91f2ae8f5ff7689084b38674cafb885761dcf6a9d4bcb88cbb7a

See more details on using hashes here.

File details

Details for the file aviv_aws_costexplorer-0.2.3-py3-none-any.whl.

File metadata

  • Download URL: aviv_aws_costexplorer-0.2.3-py3-none-any.whl
  • Upload date:
  • Size: 14.8 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for aviv_aws_costexplorer-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 a9ddcc9bf2ef27652baf164f509ed569207f681588d0e5e59e38b3dda41a5bd8
MD5 e0f6a38dd07674cfdf1bef6843432667
BLAKE2b-256 3fb313dd24d83aeb5afa7421d046cd4ef1e289c7ec0fa5f888782f263837d6cf

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page