Skip to main content

Simple and easy command line to view azure costs.

Project description

azurecost

PyPI version Build Status

Simple and easy command line to view azure costs.

Support python3 only.

Settings

az login

Examples

show cost monthly

$ azurecost -s my-subscription
key                   2023-08    2023-09
------------------  ---------  ---------
total                  492.77      80.28
Cognitive Services     492.77      80.28
Bandwidth                0          0
Storage                  0          0
  • You can omit the -s by specifying the environment variable AZURE_SUBSCRIPTION_ID.
$ export AZURE_SUBSCRIPTION_ID=xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
$ export AZURE_RESOURCE_GROUP=xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
$ azurecost
key                   2023-08    2023-09
------------------  ---------  ---------
total                  492.77      80.28
Cognitive Services     492.77      80.28
Bandwidth                0          0
Storage                  0          0

show cost (Multiple Dimensions)

$ azurecost -s my-subscription -d ResourceGroup -d ServiceName
key                                     2023-08    2023-09
------------------------------------  ---------  ---------
total                                    492.77     426.97
RG-1, Cognitive Services                 281        366
RG-2, Cognitive Services                 211.77      60.97
RG-3, Storage                              0          0
RG-4, Storage                              0          0
RG-5, Storage                              0          0
RG-6, Storage                              0          0
RG-7, Bandwidth                            0          0
RG-7, Storage                              0          0

Python API

subscription = "my-subscription"
core = Azurecost(
    False,
    "MONTHLY",
    ["ServiceName"],
    subscription_name=subscription,
    # resource_group="my-rg"
)
total_results, results = core.get_usage(
    ago=2,
)
text = core.convert_tabulate(total_results, results)
print(text)

Installation

pip install azurecost

CI

install test package

$ ./scripts/ci.sh install

test

$ ./scripts/ci.sh run-test

flake8 and black and pytest.

release pypi

$ ./scripts/ci.sh release

git tag and pypi release.

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

azurecost-0.1.9.tar.gz (6.3 kB view details)

Uploaded Source

File details

Details for the file azurecost-0.1.9.tar.gz.

File metadata

  • Download URL: azurecost-0.1.9.tar.gz
  • Upload date:
  • Size: 6.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.8

File hashes

Hashes for azurecost-0.1.9.tar.gz
Algorithm Hash digest
SHA256 261fdc170c593e0a7d3ae5995e36b159542c6b04bedf548367558a324b5e56c8
MD5 c6e939639314f27651c65c13cf401dee
BLAKE2b-256 9ff4b408d9a143ea002d600b731972a82040d1e462703af176e5bf75702bf2a0

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