

# Getting price list files using the Amazon Price List Bulk API
<a name="using-the-aws-price-list-bulk-api"></a>


|  | 
| --- |
| To provide feedback about Amazon Price List, complete this [short survey](https://amazonmr.au1.qualtrics.com/jfe/form/SV_cO0deTMyKyFeezA). Your responses will be anonymous. **Note:** This survey is in English only. | 

We recommend that you use the Price List Bulk API when you want to do the following tasks:
+ Consume large amounts of product and pricing information for Amazon Web Services services.
+ Consume product and pricing information with a high throughput for an Amazon Web Services service, such as processing in bulk.

Also, when the Price List Query API doesn't provide sufficient throughput and quotas for your use case, use the Price List Bulk API.<a name="using-the-aws-price-list-bulk-api-fetching-price-list-files"></a>

We recommend that you use the Amazon Price List Bulk API to find and download price list files programmatically. To get the URL of the price list files, see the following steps.

If you don't want to use the Amazon Price List Bulk API, you can download the price list files manually. For more information, see [Getting price list files manually](using-the-aws-price-list-bulk-api-fetching-price-list-files-manually.md).

### Step 1: Finding available Amazon Web Services services
<a name="price-bulk-api-step-1-find-available-services"></a>

Use the `DescribeServices` API operation to find all available Amazon Web Services services that the Price List Bulk API supports. This API operation returns the `ServiceCode` value from the list of services. You use this value later to find relevant price list files.

**Example: Find available services**  
The following command shows how to find available Amazon Web Services services.  

```
aws pricing describe-services --region cn-northwest-1
```
The Amazon Web Services Region is the API endpoint for the Price List Bulk API. The endpoints aren't related to product or service attributes.  
**Response**  

```
{
    "FormatVersion": "aws_v1", 
    "NextToken": "abcdefg123", 
    "Services": [ 
        {
            "AttributeNames": [ 
                "volumeType", 
                "maxIopsvolume", 
                "instanceCapacity10xlarge", 
                "locationType", 
                "operation" 
            ], 
            "ServiceCode": "AmazonEC2" 
        },
        {
            "AttributeNames": [ 
                "productFamily", 
                "volumeType", 
                "engineCode", 
                "memory" 
            ], 
            "ServiceCode": "AmazonRDS" 
        },
        {...} 
    ] 
}
```

For more information about this API operation, see [https://docs.amazonaws.cn/aws-cost-management/latest/APIReference/API_pricing_DescribeServices.html](https://docs.amazonaws.cn/aws-cost-management/latest/APIReference/API_pricing_DescribeServices.html) and [language-specific Amazon SDKs](https://docs.amazonaws.cn/aws-cost-management/latest/APIReference/API_pricing_DescribeServices.html#API_pricing_DescribeServices_SeeAlso) in the *Amazon Billing and Cost Management API Reference*

**Note**  
While the `DescribeServices` API currently doesn't return `serviceCodes` for Savings Plans, you will need the following `serviceCodes` to use Savings Plans in subsequent API calls:  


| ServiceCode | SavingsPlanCode | 
| --- | --- | 
| ComputeSavingsPlans | AWSComputeSavingsPlan | 
| MachineLearningSavingsPlans | AWSMachineLearningSavingsPlans | 
| DatabaseSavingsPlans | AWSDatabaseSavingsPlans | 
Use the `ServiceCode` values when working with the `ListPriceLists` and `GetPriceListFileUrl` API operations. The `SavingsPlanCode` is only needed if you are downloading price list files manually instead of using the APIs.

### Step 2: Finding price list files for an available Amazon Web Services service
<a name="price-list-bulk-api-step-2-find-available-price-list-files"></a>

Use the `ListPriceLists` API operation to get a list of price list references that you have permission to view. To filter your results, you can specify the `ServiceCode`, `CurrencyCode`, and `EffectiveDate` parameters.

The Amazon Web Services Region is the API endpoint for the Price List Bulk API. The endpoints aren't related to product or service attributes.

#### Examples to find price list files
<a name="price-list-bulk-api-examples-find-price-list-files"></a>

**Example: Find price list files for all Amazon Web Services Regions**  
If you don't specify the `--region-code` parameter, the API operation returns price list file references from all available Amazon Web Services Regions.   

```
aws pricing list-price-lists --service-code AmazonRDS --currency-code USD --effective-date "2023-04-03 00:00"
```
**Response**  

```
{
   "NextToken": "abcd1234",
   "PriceLists": [ 
      { 
         "CurrencyCode": "USD",
         "FileFormats": [ "json", "csv" ],
         "PriceListArn": "arn:cn:pricing:::price-list/cn/AmazonRDS/USD/20230328234721/cn-northwest-1",
         "RegionCode": "cn-northwest-1"
      },
      { 
         "CurrencyCode": "USD",
         "FileFormats": [ "json", "csv" ],
         "PriceListArn": "arn:cn:pricing:::price-list/cn/AmazonRDS/USD/20230328234721/cn-northwest-1",
         "RegionCode": "cn-northwest-1"
      },
      ...
   ]
}
```

**Example: Find price list files for a specific Region**  
If you specify the `RegionCode` parameter, the API operation returns price list file references that are specific to that Region. To find historical price list files, use the `EffectiveDate` parameter. For example, you can specify a date in the past to find a specific price list file.   
From the response, you can then use the `PriceListArn` value with the [https://docs.amazonaws.cn/aws-cost-management/latest/APIReference/API_pricing_GetPriceListFileUrl.html](https://docs.amazonaws.cn/aws-cost-management/latest/APIReference/API_pricing_GetPriceListFileUrl.html) API operation to get your preferred price list files.  

```
aws pricing list-price-lists --service-code AmazonRDS --currency-code USD --region-code cn-northwest-1 --effective-date "2023-04-03 00:00"
```
**Response**  

```
{
   "PriceLists": [ 
      { 
         "CurrencyCode": "USD",
         "FileFormats": [ "json", "csv" ],
         "PriceListArn": "arn:cn:pricing:::price-list/cn/AmazonRDS/USD/20230328234721/cn-northwest-1",
         "RegionCode": "cn-northwest-1"
      }
   ]
}
```

For more information about this API operation, see [https://docs.amazonaws.cn/aws-cost-management/latest/APIReference/API_pricing_ListPriceLists.html](https://docs.amazonaws.cn/aws-cost-management/latest/APIReference/API_pricing_ListPriceLists.html) and [language-specific Amazon SDKs](https://docs.amazonaws.cn/aws-cost-management/latest/APIReference/API_pricing_ListPriceLists.html#API_pricing_ListPriceLists_SeeAlso) in the *Amazon Billing and Cost Management API Reference*.

### Step 3: Getting a specific price list file
<a name="price-list-bulk-api-step-3-getting-specific-price-list"></a>

Use the `GetPriceListFileUrl` API operation to get a URL for a price list file. This URL is based on the `PriceListArn` and `FileFormats` values that you retrieved from the `ListPriceLists` response in [step 1](#price-bulk-api-step-1-find-available-services) and [step 2](#price-list-bulk-api-step-2-find-available-price-list-files) 

**Example: Get a specific price list file**  
The following command gets the URL for a specific price list file for Amazon RDS.  

```
aws pricing get-price-list-file-url --price-list-arn arn:cn:pricing:::price-list/cn/AmazonRDS/USD/20230328234721/cn-northwest-1 --file-format json --region cn-northwest-1
```
**Response**  

```
{
    "Url": "https://pricing.cn-northwest-1.amazonaws.com/offers/v1.0/aws/AmazonRDS/20230328234721/cn-northwest-1/index.json"
}
```
From the response, you can use the URL to download the price list file.

For more information about this API operation, see the following topics:
+  [https://docs.amazonaws.cn/aws-cost-management/latest/APIReference/API_pricing_GetPriceListFileUrl.html](https://docs.amazonaws.cn/aws-cost-management/latest/APIReference/API_pricing_GetPriceListFileUrl.html) and [language-specific Amazon SDKs](https://docs.amazonaws.cn/aws-cost-management/latest/APIReference/API_pricing_GetPriceListFileUrl.html#API_pricing_GetPriceListFileUrl_SeeAlso) in the *Amazon Billing and Cost Management API Reference*
+ [Reading the price list files](bulk-api-reading-price-list-files.md)