Skip to main content

Retrieves data from aws cost explore as a pandas dataframe.

Project description

cepan

test lint Code style: black Code style: black License: MIT

Retrieves data from aws cost explore as a pandas dataframe.

Main features

  • Support for input with type hints
  • Retrieving results as pandas.Dataframe

Installation

pip install cepan

Usage

from datetime import datetime

import cepan as ce

df = ce.get_cost_and_usage(
    time_period=ce.TimePeriod(
        start=datetime(2020, 1, 1),
        end=datetime(2020, 1, 2),
    ),
    granularity="DAILY",
    filter=ce.And(
        [
            ce.Dimensions(
                "SERVICE",
                ["Amazon Simple Storage Service", "AmazonCloudWatch"],    
            ),
            ce.Tags("Stack", ["Production"]),
        ]
    ),
    metrics=["BLENDED_COST"],
    group_by=ce.GroupBy(
        dimensions=["SERVICE", "USAGE_TYPE"],
    ),
)
print(df)

All paginated results will be returned as a Dataframe.

          Time                        SERVICE  BlendedCost
0   2020-01-01  Amazon Simple Storage Service   100.000000
1   2020-01-01               AmazonCloudWatch    10.000000

List of currently supported APIs

  • get_dimension_values
  • get_tags
  • get_cost_and_usage

License

MIT License

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

cepan-0.1.0.tar.gz (7.7 kB view hashes)

Uploaded Source

Built Distribution

cepan-0.1.0-py3-none-any.whl (10.3 kB view hashes)

Uploaded Python 3

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