SDK for PHP 3.x

Client: Aws\Pricing\PricingClient
Service ID: pricing
Version: 2017-10-15

This page describes the parameters and results for the operations of the AWS Price List Service (2017-10-15), and shows how to use the Aws\Pricing\PricingClient object to call the described operations. This documentation is specific to the 2017-10-15 API version of the service.

Operation Summary

Each of the following operations can be created from a client using $client->getCommand('CommandName'), where "CommandName" is the name of one of the following operations. Note: a command is a value that encapsulates an operation and the parameters used to create an HTTP request.

You can also create and send a command immediately using the magic methods available on a client object: $client->commandName(/* parameters */). You can send the command asynchronously (returning a promise) by appending the word "Async" to the operation name: $client->commandNameAsync(/* parameters */).

DescribeServices ( array $params = [] )
Returns the metadata for one service or a list of the metadata for all services.
GetAttributeValues ( array $params = [] )
Returns a list of attribute values.
GetPriceListFileUrl ( array $params = [] )
This feature is in preview release and is subject to change.
GetProducts ( array $params = [] )
Returns a list of all products that match the filter criteria.
ListPriceLists ( array $params = [] )
This feature is in preview release and is subject to change.

Paginators

Paginators handle automatically iterating over paginated API results. Paginators are associated with specific API operations, and they accept the parameters that the corresponding API operation accepts. You can get a paginator from a client class using getPaginator($paginatorName, $operationParameters). This client supports the following paginators:

DescribeServices
GetAttributeValues
GetProducts
ListPriceLists

Operations

DescribeServices

$result = $client->describeServices([/* ... */]);
$promise = $client->describeServicesAsync([/* ... */]);

Returns the metadata for one service or a list of the metadata for all services. Use this without a service code to get the service codes for all services. Use it with a service code, such as AmazonEC2, to get information specific to that service, such as the attribute names available for that service. For example, some of the attribute names available for EC2 are volumeType, maxIopsVolume, operation, locationType, and instanceCapacity10xlarge.

Parameter Syntax

$result = $client->describeServices([
    'FormatVersion' => '<string>',
    'MaxResults' => <integer>,
    'NextToken' => '<string>',
    'ServiceCode' => '<string>',
]);

Parameter Details

Members
FormatVersion
Type: string

The format version that you want the response to be in.

Valid values are: aws_v1

MaxResults
Type: int

The maximum number of results that you want returned in the response.

NextToken
Type: string

The pagination token that indicates the next set of results that you want to retrieve.

ServiceCode
Type: string

The code for the service whose information you want to retrieve, such as AmazonEC2. You can use the ServiceCode to filter the results in a GetProducts call. To retrieve a list of all services, leave this blank.

Result Syntax

[
    'FormatVersion' => '<string>',
    'NextToken' => '<string>',
    'Services' => [
        [
            'AttributeNames' => ['<string>', ...],
            'ServiceCode' => '<string>',
        ],
        // ...
    ],
]

Result Details

Members
FormatVersion
Type: string

The format version of the response. For example, aws_v1.

NextToken
Type: string

The pagination token for the next set of retrievable results.

Services
Type: Array of Service structures

The service metadata for the service or services in the response.

Errors

InvalidParameterException:

One or more parameters had an invalid value.

InvalidNextTokenException:

The pagination token is invalid. Try again without a pagination token.

NotFoundException:

The requested resource can't be found.

InternalErrorException:

An error on the server occurred during the processing of your request. Try again later.

ThrottlingException:

You've made too many requests exceeding service quotas.

ExpiredNextTokenException:

The pagination token expired. Try again without a pagination token.

Examples

Example 1: To retrieve a list of services and service codes

Retrieves the service for the given Service Code.

$result = $client->describeServices([
    'FormatVersion' => 'aws_v1',
    'MaxResults' => 1,
    'ServiceCode' => 'AmazonEC2',
]);

Result syntax:

[
    'FormatVersion' => 'aws_v1',
    'NextToken' => 'abcdefg123',
    'Services' => [
        [
            'AttributeNames' => [
                'volumeType',
                'maxIopsvolume',
                'instanceCapacity10xlarge',
                'locationType',
                'operation',
            ],
            'ServiceCode' => 'AmazonEC2',
        ],
    ],
]

GetAttributeValues

$result = $client->getAttributeValues([/* ... */]);
$promise = $client->getAttributeValuesAsync([/* ... */]);

Returns a list of attribute values. Attributes are similar to the details in a Price List API offer file. For a list of available attributes, see Offer File Definitions in the Billing and Cost Management User Guide.

Parameter Syntax

$result = $client->getAttributeValues([
    'AttributeName' => '<string>', // REQUIRED
    'MaxResults' => <integer>,
    'NextToken' => '<string>',
    'ServiceCode' => '<string>', // REQUIRED
]);

Parameter Details

Members
AttributeName
Required: Yes
Type: string

The name of the attribute that you want to retrieve the values for, such as volumeType.

MaxResults
Type: int

The maximum number of results to return in response.

NextToken
Type: string

The pagination token that indicates the next set of results that you want to retrieve.

ServiceCode
Required: Yes
Type: string

The service code for the service whose attributes you want to retrieve. For example, if you want the retrieve an EC2 attribute, use AmazonEC2.

Result Syntax

[
    'AttributeValues' => [
        [
            'Value' => '<string>',
        ],
        // ...
    ],
    'NextToken' => '<string>',
]

Result Details

Members
AttributeValues
Type: Array of AttributeValue structures

The list of values for an attribute. For example, Throughput Optimized HDD and Provisioned IOPS are two available values for the AmazonEC2 volumeType.

NextToken
Type: string

The pagination token that indicates the next set of results to retrieve.

Errors

InvalidParameterException:

One or more parameters had an invalid value.

InvalidNextTokenException:

The pagination token is invalid. Try again without a pagination token.

NotFoundException:

The requested resource can't be found.

InternalErrorException:

An error on the server occurred during the processing of your request. Try again later.

ThrottlingException:

You've made too many requests exceeding service quotas.

ExpiredNextTokenException:

The pagination token expired. Try again without a pagination token.

Examples

Example 1: To retrieve a list of attribute values

This operation returns a list of values available for the given attribute.

$result = $client->getAttributeValues([
    'AttributeName' => 'volumeType',
    'MaxResults' => 2,
    'ServiceCode' => 'AmazonEC2',
]);

Result syntax:

[
    'AttributeValues' => [
        [
            'Value' => 'Throughput Optimized HDD',
        ],
        [
            'Value' => 'Provisioned IOPS',
        ],
    ],
    'NextToken' => 'GpgauEXAMPLEezucl5LV0w==:7GzYJ0nw0DBTJ2J66EoTIIynE6O1uXwQtTRqioJzQadBnDVgHPzI1en4BUQnPCLpzeBk9RQQAWaFieA4+DapFAGLgk+Z/9/cTw9GldnPOHN98+FdmJP7wKU3QQpQ8MQr5KOeBkIsAqvAQYdL0DkL7tHwPtE5iCEByAmg9gcC/yBU1vAOsf7R3VaNN4M5jMDv3woSWqASSIlBVB6tgW78YL22KhssoItM/jWW+aP6Jqtq4mldxp/ct6DWAl+xLFwHU/CbketimPPXyqHF3/UXDw==',
]

GetPriceListFileUrl

$result = $client->getPriceListFileUrl([/* ... */]);
$promise = $client->getPriceListFileUrlAsync([/* ... */]);

This feature is in preview release and is subject to change. Your use of Amazon Web Services Price List API is subject to the Beta Service Participation terms of the Amazon Web Services Service Terms (Section 1.10).

This returns the URL that you can retrieve your Price List file from. This URL is based on the PriceListArn and FileFormat that you retrieve from the ListPriceLists response.

Parameter Syntax

$result = $client->getPriceListFileUrl([
    'FileFormat' => '<string>', // REQUIRED
    'PriceListArn' => '<string>', // REQUIRED
]);

Parameter Details

Members
FileFormat
Required: Yes
Type: string

The format that you want to retrieve your Price List files in. The FileFormat can be obtained from the ListPriceLists response.

PriceListArn
Required: Yes
Type: string

The unique identifier that maps to where your Price List files are located. PriceListArn can be obtained from the ListPriceLists response.

Result Syntax

[
    'Url' => '<string>',
]

Result Details

Members
Url
Type: string

The URL to download your Price List file from.

Errors

InvalidParameterException:

One or more parameters had an invalid value.

NotFoundException:

The requested resource can't be found.

AccessDeniedException:

General authentication failure. The request wasn't signed correctly.

InternalErrorException:

An error on the server occurred during the processing of your request. Try again later.

ThrottlingException:

You've made too many requests exceeding service quotas.

ResourceNotFoundException:

The requested resource can't be found.

GetProducts

$result = $client->getProducts([/* ... */]);
$promise = $client->getProductsAsync([/* ... */]);

Returns a list of all products that match the filter criteria.

Parameter Syntax

$result = $client->getProducts([
    'Filters' => [
        [
            'Field' => '<string>', // REQUIRED
            'Type' => 'TERM_MATCH', // REQUIRED
            'Value' => '<string>', // REQUIRED
        ],
        // ...
    ],
    'FormatVersion' => '<string>',
    'MaxResults' => <integer>,
    'NextToken' => '<string>',
    'ServiceCode' => '<string>', // REQUIRED
]);

Parameter Details

Members
Filters
Type: Array of Filter structures

The list of filters that limit the returned products. only products that match all filters are returned.

FormatVersion
Type: string

The format version that you want the response to be in.

Valid values are: aws_v1

MaxResults
Type: int

The maximum number of results to return in the response.

NextToken
Type: string

The pagination token that indicates the next set of results that you want to retrieve.

ServiceCode
Required: Yes
Type: string

The code for the service whose products you want to retrieve.

Result Syntax

[
    'FormatVersion' => '<string>',
    'NextToken' => '<string>',
    'PriceList' => ['<string>', ...],
]

Result Details

Members
FormatVersion
Type: string

The format version of the response. For example, aws_v1.

NextToken
Type: string

The pagination token that indicates the next set of results to retrieve.

PriceList
Type: Array of string (string|number|array|map or anything parsable by json_encode)s

The list of products that match your filters. The list contains both the product metadata and the price information.

Errors

InvalidParameterException:

One or more parameters had an invalid value.

InvalidNextTokenException:

The pagination token is invalid. Try again without a pagination token.

NotFoundException:

The requested resource can't be found.

InternalErrorException:

An error on the server occurred during the processing of your request. Try again later.

ThrottlingException:

You've made too many requests exceeding service quotas.

ExpiredNextTokenException:

The pagination token expired. Try again without a pagination token.

ListPriceLists

$result = $client->listPriceLists([/* ... */]);
$promise = $client->listPriceListsAsync([/* ... */]);

This feature is in preview release and is subject to change. Your use of Amazon Web Services Price List API is subject to the Beta Service Participation terms of the Amazon Web Services Service Terms (Section 1.10).

This returns a list of Price List references that the requester if authorized to view, given a ServiceCode, CurrencyCode, and an EffectiveDate. Use without a RegionCode filter to list Price List references from all available Amazon Web Services Regions. Use with a RegionCode filter to get the Price List reference that's specific to a specific Amazon Web Services Region. You can use the PriceListArn from the response to get your preferred Price List files through the GetPriceListFileUrl API.

Parameter Syntax

$result = $client->listPriceLists([
    'CurrencyCode' => '<string>', // REQUIRED
    'EffectiveDate' => <integer || string || DateTime>, // REQUIRED
    'MaxResults' => <integer>,
    'NextToken' => '<string>',
    'RegionCode' => '<string>',
    'ServiceCode' => '<string>', // REQUIRED
]);

Parameter Details

Members
CurrencyCode
Required: Yes
Type: string

The three alphabetical character ISO-4217 currency code that the Price List files are denominated in.

EffectiveDate
Required: Yes
Type: timestamp (string|DateTime or anything parsable by strtotime)

The date that the Price List file prices are effective from.

MaxResults
Type: int

The maximum number of results to return in the response.

NextToken
Type: string

The pagination token that indicates the next set of results that you want to retrieve.

RegionCode
Type: string

This is used to filter the Price List by Amazon Web Services Region. For example, to get the price list only for the US East (N. Virginia) Region, use us-east-1. If nothing is specified, you retrieve price lists for all applicable Regions. The available RegionCode list can be retrieved from GetAttributeValues API.

ServiceCode
Required: Yes
Type: string

The service code or the Savings Plan service code for the attributes that you want to retrieve. For example, to get the list of applicable Amazon EC2 price lists, use AmazonEC2. For a full list of service codes containing On-Demand and Reserved Instance (RI) pricing, use the DescribeServices API.

To retrieve the Reserved Instance and Compute Savings Plan price lists, use ComputeSavingsPlans.

To retrieve Machine Learning Savings Plans price lists, use MachineLearningSavingsPlans.

Result Syntax

[
    'NextToken' => '<string>',
    'PriceLists' => [
        [
            'CurrencyCode' => '<string>',
            'FileFormats' => ['<string>', ...],
            'PriceListArn' => '<string>',
            'RegionCode' => '<string>',
        ],
        // ...
    ],
]

Result Details

Members
NextToken
Type: string

The pagination token that indicates the next set of results to retrieve.

PriceLists
Type: Array of PriceList structures

The type of price list references that match your request.

Errors

InvalidParameterException:

One or more parameters had an invalid value.

InvalidNextTokenException:

The pagination token is invalid. Try again without a pagination token.

NotFoundException:

The requested resource can't be found.

AccessDeniedException:

General authentication failure. The request wasn't signed correctly.

InternalErrorException:

An error on the server occurred during the processing of your request. Try again later.

ThrottlingException:

You've made too many requests exceeding service quotas.

ResourceNotFoundException:

The requested resource can't be found.

ExpiredNextTokenException:

The pagination token expired. Try again without a pagination token.

Shapes

AccessDeniedException

Description

General authentication failure. The request wasn't signed correctly.

Members
Message
Type: string

AttributeValue

Description

The values of a given attribute, such as Throughput Optimized HDD or Provisioned IOPS for the Amazon EC2 volumeType attribute.

Members
Value
Type: string

The specific value of an attributeName.

ExpiredNextTokenException

Description

The pagination token expired. Try again without a pagination token.

Members
Message
Type: string

Filter

Description

The constraints that you want all returned products to match.

Members
Field
Required: Yes
Type: string

The product metadata field that you want to filter on. You can filter by just the service code to see all products for a specific service, filter by just the attribute name to see a specific attribute for multiple services, or use both a service code and an attribute name to retrieve only products that match both fields.

Valid values include: ServiceCode, and all attribute names

For example, you can filter by the AmazonEC2 service code and the volumeType attribute name to get the prices for only Amazon EC2 volumes.

Type
Required: Yes
Type: string

The type of filter that you want to use.

Valid values are: TERM_MATCH. TERM_MATCH returns only products that match both the given filter field and the given value.

Value
Required: Yes
Type: string

The service code or attribute value that you want to filter by. If you're filtering by service code this is the actual service code, such as AmazonEC2. If you're filtering by attribute name, this is the attribute value that you want the returned products to match, such as a Provisioned IOPS volume.

InternalErrorException

Description

An error on the server occurred during the processing of your request. Try again later.

Members
Message
Type: string

InvalidNextTokenException

Description

The pagination token is invalid. Try again without a pagination token.

Members
Message
Type: string

InvalidParameterException

Description

One or more parameters had an invalid value.

Members
Message
Type: string

NotFoundException

Description

The requested resource can't be found.

Members
Message
Type: string

PriceList

Description

This feature is in preview release and is subject to change. Your use of Amazon Web Services Price List API is subject to the Beta Service Participation terms of the Amazon Web Services Service Terms (Section 1.10).

This is the type of price list references that match your request.

Members
CurrencyCode
Type: string

The three alphabetical character ISO-4217 currency code the Price List files are denominated in.

FileFormats
Type: Array of strings

The format you want to retrieve your Price List files. The FileFormat can be obtained from the ListPriceList response.

PriceListArn
Type: string

The unique identifier that maps to where your Price List files are located. PriceListArn can be obtained from the ListPriceList response.

RegionCode
Type: string

This is used to filter the Price List by Amazon Web Services Region. For example, to get the price list only for the US East (N. Virginia) Region, use us-east-1. If nothing is specified, you retrieve price lists for all applicable Regions. The available RegionCode list can be retrieved from GetAttributeValues API.

ResourceNotFoundException

Description

The requested resource can't be found.

Members
Message
Type: string

Service

Description

The metadata for a service, such as the service code and available attribute names.

Members
AttributeNames
Type: Array of strings

The attributes that are available for this service.

ServiceCode
Required: Yes
Type: string

The code for the Amazon Web Services service.

ThrottlingException

Description

You've made too many requests exceeding service quotas.

Members
Message
Type: string