Skip to main content

TBD

Project description

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.

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

csp_billing_adapter_amazon-1.4.0.tar.gz (14.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

csp_billing_adapter_amazon-1.4.0-py3-none-any.whl (10.7 kB view details)

Uploaded Python 3

File details

Details for the file csp_billing_adapter_amazon-1.4.0.tar.gz.

File metadata

File hashes

Hashes for csp_billing_adapter_amazon-1.4.0.tar.gz
Algorithm Hash digest
SHA256 5bedf602caf7050466ca1336729c7259736339fdbd679138e58f8d4a8a3783bd
MD5 3afc9b54062775a142229496a462ba2b
BLAKE2b-256 64df9c6529657c42e1a03ec3082e1bd673a977871dc4f70daf5e31e45c27dd30

See more details on using hashes here.

Provenance

The following attestation bundles were made for csp_billing_adapter_amazon-1.4.0.tar.gz:

Publisher: pypi-publish.yml on SUSE-Enceladus/csp-billing-adapter-amazon

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file csp_billing_adapter_amazon-1.4.0-py3-none-any.whl.

File metadata

File hashes

Hashes for csp_billing_adapter_amazon-1.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cecb0d337e1b259df58a1e534e362dfd26d0d9aed954949fc04b3c8bc7d1de6b
MD5 f8921833fed8ac7e7d8a72e1042db3be
BLAKE2b-256 2867eec6c0979c3d1c79c3485645136fba93de7670052699de8a10bb6bbfc016

See more details on using hashes here.

Provenance

The following attestation bundles were made for csp_billing_adapter_amazon-1.4.0-py3-none-any.whl:

Publisher: pypi-publish.yml on SUSE-Enceladus/csp-billing-adapter-amazon

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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