Skip to main content

Utility package to calculate cost of an AWS EMR cluster

Project description

EMR Cost Calculator

Features at a glance

  • Calculates exact costs of an EMR cluster (EMR + EC2 costs)
  • Multiple EMR clusters cost calculation for a given period
  • Spot prices and all other prices are exact and retrieved every time from AWS Pricing API
  • If a cluster is still running, costs incurred up to current time are displayed

Why the need for this script

Given that Amazon doesn't provide a straightforward solution to calculate the cost of an EMR workflow, this module aims to calculate the cost of an EMR workflow given a period of days, or the cost of a single cluster given the cluster id. The simple way to do that would be to use the information given by the JobFLow method of the boto.emr module. However, this method doesn't return any information about the Task nodes of a cluster, and whether or not spot instances were used. This cost calculator takes care of both. OnDemand instance prices are retrieved using the AWS pricing API. In case spot instances were used, the price is retrieved using the AWS EC2 API.

How it works

This module is using docopt to parse command line arguments.

It currently supports two operations:

  1. Get the total cost of an EMR workflow for a given period of days
  • aws-emr-cost-calculator total --created_after=<YYYY-MM-DD> --created_before=<YYYY-MM-DD>
  1. Get the cost of an EMR cluster given the cluster id
  • aws-emr-cost-calculator cluster --cluster_id=<j-xxxxxxxxxxxx>

Authentication to AWS API is done using credentials of AWS CLI which are configured by executing aws configure

Install

To install all requirements it's best to use pip install -r requirements.txt

Users with python<2.7.9 won't be able to run the code if requests[security] isn't installed (which is listed in requirements.txt)
Python 3.7 is tested, lower 3x versions will probably work though.

License

Distributed under the MIT license. See LICENSE for more information.

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

aws-emr-cost-calculator-0.0.1.tar.gz (6.3 kB view details)

Uploaded Source

Built Distribution

aws_emr_cost_calculator-0.0.1-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

Details for the file aws-emr-cost-calculator-0.0.1.tar.gz.

File metadata

  • Download URL: aws-emr-cost-calculator-0.0.1.tar.gz
  • Upload date:
  • Size: 6.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.0

File hashes

Hashes for aws-emr-cost-calculator-0.0.1.tar.gz
Algorithm Hash digest
SHA256 bc3732cfd6e61c8f2abe4f3750a636c6e03174f70e566cfd76d0b125ab8d3bd2
MD5 d056a74614c6cefc7add9a871f59737e
BLAKE2b-256 6473bbafff9342db84ac3a5a9bbad1fb33d8a06c83c979976d974569f57541d4

See more details on using hashes here.

File details

Details for the file aws_emr_cost_calculator-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: aws_emr_cost_calculator-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 7.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.0

File hashes

Hashes for aws_emr_cost_calculator-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a26b15a32dfd8bd94bcc74978cc99d2e413a900dc527b677ed72a6273c8b159f
MD5 bbae993d4b2ee0a0e8ec9a33e703d354
BLAKE2b-256 f6f26478d9c31396d078aac5ec6c52123338dd98cae6ef33f7aa82e662df5324

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