Provision standard (manual) throughput on an Azure Cosmos container - SQL API
APPLIES TO:
SQL API
This article explains how to provision standard (manual) throughput on a container in Azure Cosmos DB SQL API. You can provision throughput on a single container, or provision throughput on a database and share it among the containers within the database. You can provision throughput on a container using Azure portal, Azure CLI, or Azure Cosmos DB SDKs.
If you are using a different API, see API for MongoDB, Cassandra API, Gremlin API articles to provision the throughput.
Azure portal
Sign in to the Azure portal.
Create a new Azure Cosmos account, or select an existing Azure Cosmos account.
Open the Data Explorer pane, and select New Container. Next, provide the following details:
- Indicate whether you are creating a new database or using an existing one.
- Enter a Container ID.
- Enter a partition key value (for example,
/ItemID
). - Enter a throughput that you want to provision (for example, 1000 RUs).
- Select OK.
Azure CLI or PowerShell
To create a container with dedicated throughput see,
.NET SDK
Note
Use the Cosmos SDKs for SQL API to provision throughput for all Cosmos DB APIs, except Cassandra and MongoDB API.
// Create a container with a partition key and provision throughput of 400 RU/s
DocumentCollection myCollection = new DocumentCollection();
myCollection.Id = "myContainerName";
myCollection.PartitionKey.Paths.Add("/myPartitionKey");
await client.CreateDocumentCollectionAsync(
UriFactory.CreateDatabaseUri("myDatabaseName"),
myCollection,
new RequestOptions { OfferThroughput = 400 });
JavaScript SDK
// Create a new Client
const client = new CosmosClient({ endpoint, key });
// Create a database
const { database } = await client.databases.createIfNotExists({ id: "databaseId" });
// Create a container with the specified throughput
const { resource } = await database.containers.createIfNotExists({
id: "containerId",
throughput: 1000
});
// To update an existing container or databases throughput, you need to user the offers API
// Get all the offers
const { resources: offers } = await client.offers.readAll().fetchAll();
// Find the offer associated with your container or the database
const offer = offers.find((_offer) => _offer.offerResourceId === resource._rid);
// Change the throughput value
offer.content.offerThroughput = 2000;
// Replace the offer.
await client.offer(offer.id).replace(offer);
Next steps
See the following articles to learn about throughput provisioning in Azure Cosmos DB: