describe_services

Pricing.Client.describe_services(**kwargs)

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 .

See also: AWS API Documentation

Request Syntax

response = client.describe_services(
    ServiceCode='string',
    FormatVersion='string',
    NextToken='string',
    MaxResults=123
)
Parameters
  • ServiceCode (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.
  • FormatVersion (string) --

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

    Valid values are: aws_v1

  • NextToken (string) -- The pagination token that indicates the next set of results that you want to retrieve.
  • MaxResults (integer) -- The maximum number of results that you want returned in the response.
Return type

dict

Returns

Response Syntax

{
    'Services': [
        {
            'ServiceCode': 'string',
            'AttributeNames': [
                'string',
            ]
        },
    ],
    'FormatVersion': 'string',
    'NextToken': 'string'
}

Response Structure

  • (dict) --

    • Services (list) --

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

      • (dict) --

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

        • ServiceCode (string) --

          The code for the Amazon Web Services service.

        • AttributeNames (list) --

          The attributes that are available for this service.

          • (string) --
    • FormatVersion (string) --

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

    • NextToken (string) --

      The pagination token for the next set of retrievable results.

Exceptions

  • Pricing.Client.exceptions.InternalErrorException
  • Pricing.Client.exceptions.InvalidParameterException
  • Pricing.Client.exceptions.NotFoundException
  • Pricing.Client.exceptions.InvalidNextTokenException
  • Pricing.Client.exceptions.ExpiredNextTokenException

Examples

Retrieves the service for the given Service Code.

response = client.describe_services(
    FormatVersion='aws_v1',
    MaxResults=1,
    ServiceCode='AmazonEC2',
)

print(response)

Expected Output:

{
    'FormatVersion': 'aws_v1',
    'NextToken': 'abcdefg123',
    'Services': [
        {
            'AttributeNames': [
                'volumeType',
                'maxIopsvolume',
                'instanceCapacity10xlarge',
                'locationType',
                'operation',
            ],
            'ServiceCode': 'AmazonEC2',
        },
    ],
    'ResponseMetadata': {
        '...': '...',
    },
}