CSP Billing Adapter Amazon Plugin
This is a plugin for csp-billing-adapter that provides CSP hook implementations. This includes the hooks defined in the csp_hookspecs.py module. To enable metered billing in Amazon the container or instance is required to have MeterUsage permissions. This can be added with a role policy such as:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "CSPBillingAdapterPermissions",
"Effect": "Allow",
"Action": [
"aws-marketplace:MeterUsage"
],
"Resource": "*"
}
]
}
Meter billing
The meter_billing function accepts a dictionary mapping of dimension name
to usage quantity. This information is used to bill the customer for
the product ID that is configured in the adapter. If there is an exception
with metered billing the exception is raised.
Get CSP Name
The get_csp_name function returns the name of the CSP provider. In this
case it is Amazon.
Get Account Info
The get_account_info function provides metadata information for the running
instance or container. The structure of this information is as follows:
{
"document": {
"accountId": "1234567890",
"architecture": "x86_64",
"availabilityZone": "us-east-1d",
"billingProducts": null,
"devpayProductCodes": null,
"marketplaceProductCodes": null,
"imageId": "ami-1234567890abcdefg",
"instanceId": "i-1234567890abcdefg",
"instanceType": "t2.micro",
"kernelId": null,
"pendingTime": "2023-05-23T19:46:52Z",
"privateIp": "192.168.0.201",
"ramdiskId": null,
"region": "us-east-1",
"version": "2017-09-30"
},
"signature": "signature",
"pkcs7": "pkcs7",
"cloud_provider": "amazon"
}
This information is pulled from the Amazon Instance metadata endpoint: http://169.254.169.254/latest. Note: the exact information in the document entry may vary.
Release files for csp-billing-adapter-amazon 1.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| csp_billing_adapter_amazon-1.4.0.tar.gz | 14.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| csp_billing_adapter_amazon-1.4.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 24.9 kB
Release files / csp_billing_adapter_amazon-1.4.0.tar.gz
| Download URL | csp_billing_adapter_amazon-1.4.0.tar.gz |
|---|---|
| Size | 14.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5bedf602caf7050466ca1336729c7259736339fdbd679138e58f8d4a8a3783bd
|
|
BLAKE2b-256 checksum How to use checksums |
64df9c6529657c42e1a03ec3082e1bd673a977871dc4f70daf5e31e45c27dd30
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 8, 2026.
Transparency logRelease files / csp_billing_adapter_amazon-1.4.0-py3-none-any.whl
| Download URL | csp_billing_adapter_amazon-1.4.0-py3-none-any.whl |
|---|---|
| Size | 10.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cecb0d337e1b259df58a1e534e362dfd26d0d9aed954949fc04b3c8bc7d1de6b
|
|
BLAKE2b-256 checksum How to use checksums |
2867eec6c0979c3d1c79c3485645136fba93de7670052699de8a10bb6bbfc016
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 8, 2026.
Transparency log