LinuxCommandLibrary

aws-pricing

Get AWS service pricing information

TLDR

List service codes of a specific region

$ aws pricing describe-services --region [us-east-1]
copy

List attributes for a given service code in a specific region
$ aws pricing describe-services --service-code [AmazonEC2] --region [us-east-1]
copy

Print pricing information for a service code in a specific region
$ aws pricing get-products --service-code [AmazonEC2] --region [us-east-1]
copy

List values for a specific attribute for a service code in a specific region
$ aws pricing get-attribute-values --service-code [AmazonEC2] --attribute-name [instanceType] --region [us-east-1]
copy

Print pricing information for a service code using filters for instance type and location
$ aws pricing get-products --service-code [AmazonEC2] --filters "[Type=TERM_MATCH,Field=instanceType,Value=m5.xlarge]" "[Type=TERM_MATCH,Field=location,Value=US East (N. Virginia)]" --region [us-east-1]
copy

SYNOPSIS

aws-pricing command [--service-code ] [--filters ] [--region ] [--output ] [--profile ] [--debug]

PARAMETERS

--service-code
    Filter by AWS service code (e.g., AmazonEC2)

--filters
    JSON array of filters for attributes like region, instanceType, os

--format-version
    Pricing data format version (e.g., aws_v1)

--max-results
    Maximum number of results to return (1-1000)

--next-token
    Pagination token from previous response

--region
    AWS region (e.g., us-east-1)

--output
    Output format: json|text|table

--profile
    AWS profile name from credentials file

--debug
    Enable debug logging

--no-paginate
    Disable automatic pagination

--page-size
    Number of results per page

--cli-input-json
    JSON input file for parameters

DESCRIPTION

The aws-pricing command-line tool interacts with the AWS Pricing API to retrieve detailed pricing data for AWS services, regions, and products. It enables users to query current prices, attributes, and service details programmatically, aiding in cost estimation, billing analysis, and financial planning.

Built on the AWS CLI framework, aws-pricing requires configured AWS credentials (via AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, etc.) and supports JSON, text, or table output formats. Common use cases include listing available services with describe-services, fetching product prices via get-products, or retrieving filterable attributes.

This tool is essential for DevOps, finance teams, and developers automating cost management without relying on the web-based Pricing Calculator. Note that pricing data is real-time but subject to AWS updates, and some information may require specific permissions like pricing:DescribeServices. Usage is free but counts toward API request limits.

CAVEATS

Requires AWS CLI v2+ and pricing permissions; not all prices include taxes or discounts; data is indicative, verify with AWS support for contracts.

SUBCOMMANDS

describe-services: List available services.
get-products: Retrieve product prices.
get-attribute-values: Get filterable values.
get-attribute-names: List attributes.

EXAMPLE

aws-pricing get-products --service-code AmazonEC2 --filters '[{"Type":"TERM_MATCH","Field":"regionCode","Value":"us-east-1"}]'

HISTORY

Introduced in AWS CLI v1.11 (2016) as part of Pricing API GA; enhanced in v2 with better pagination and filter support. AWS Pricing API launched publicly in 2017 to promote transparency.

SEE ALSO

aws(1), jq(1), aws-cost-cli(1)

Copied to clipboard