Skip to content

Commit c583fd5

Browse files
committed
Autoscale and Free Tier Templates
1 parent d83fd0e commit c583fd5

6 files changed

+159
-1622
lines changed

articles/cosmos-db/manage-cassandra-with-resource-manager.md

Lines changed: 36 additions & 225 deletions
Original file line numberDiff line numberDiff line change
@@ -4,238 +4,49 @@ description: Use Azure Resource Manager templates to create and configure Azure
44
author: markjbrown
55
ms.service: cosmos-db
66
ms.topic: conceptual
7-
ms.date: 04/27/2020
7+
ms.date: 04/30/2020
88
ms.author: mjbrown
99
---
1010

1111
# Manage Azure Cosmos DB Cassandra API resources using Azure Resource Manager templates
1212

13-
This article describes how to perform different operations to automate management of your Azure Cosmos DB accounts, databases and containers using Azure Resource Manager templates. This article has examples for Cassandra API accounts only, to find examples for other API type accounts see: use Azure Resource Manager templates with Azure Cosmos DB's API for [SQL](manage-sql-with-resource-manager.md), [Gremlin](manage-gremlin-with-resource-manager.md), [MongoDB](manage-mongodb-with-resource-manager.md), [Table](manage-table-with-resource-manager.md) articles.
14-
15-
## Create Azure Cosmos account, keyspace and table <a id="create-resource"></a>
16-
17-
Create Azure Cosmos DB resources using an Azure Resource Manager template. This template will create an Azure Cosmos account for Cassandra API with two tables that share 400 RU/s throughput at the keyspace-level. Copy the template and deploy as shown below or visit [Azure Quickstart Gallery](https://azure.microsoft.com/resources/templates/101-cosmosdb-cassandra/) and deploy from the Azure portal. You can also download the template to your local computer or create a new template and specify the local path with the `--template-file` parameter.
18-
19-
> [!NOTE]
20-
> Account names must be lowercase and 44 or fewer characters.
21-
> To update RU/s, resubmit the template with updated throughput property values.
22-
23-
```json
24-
{
25-
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
26-
"contentVersion": "1.0.0.0",
27-
"parameters": {
28-
"accountName": {
29-
"type": "string",
30-
"defaultValue": "",
31-
"metadata": {
32-
"description": "Cosmos DB account name, max length 44 characters"
33-
}
34-
},
35-
"location": {
36-
"type": "string",
37-
"defaultValue": "[resourceGroup().location]",
38-
"metadata": {
39-
"description": "Location for the Cosmos DB account."
40-
}
41-
},
42-
"primaryRegion":{
43-
"type":"string",
44-
"metadata": {
45-
"description": "The primary replica region for the Cosmos DB account."
46-
}
47-
},
48-
"secondaryRegion":{
49-
"type":"string",
50-
"metadata": {
51-
"description": "The secondary replica region for the Cosmos DB account."
52-
}
53-
},
54-
"defaultConsistencyLevel": {
55-
"type": "string",
56-
"defaultValue": "Session",
57-
"allowedValues": [ "Eventual", "ConsistentPrefix", "Session", "BoundedStaleness", "Strong" ],
58-
"metadata": {
59-
"description": "The default consistency level of the Cosmos DB account."
60-
}
61-
},
62-
"maxStalenessPrefix": {
63-
"type": "int",
64-
"defaultValue": 100000,
65-
"minValue": 10,
66-
"maxValue": 1000000,
67-
"metadata": {
68-
"description": "Max stale requests. Required for BoundedStaleness. Valid ranges, Single Region: 10 to 1000000. Multi Region: 100000 to 1000000."
69-
}
70-
},
71-
"maxIntervalInSeconds": {
72-
"type": "int",
73-
"defaultValue": 300,
74-
"minValue": 5,
75-
"maxValue": 86400,
76-
"metadata": {
77-
"description": "Max lag time (seconds). Required for BoundedStaleness. Valid ranges, Single Region: 5 to 84600. Multi Region: 300 to 86400."
78-
}
79-
},
80-
"automaticFailover": {
81-
"type": "bool",
82-
"defaultValue": true,
83-
"allowedValues": [ true, false ],
84-
"metadata": {
85-
"description": "Enable automatic failover for regions"
86-
}
87-
},
88-
"keyspaceName": {
89-
"type": "string",
90-
"defaultValue": "Keyspace1",
91-
"metadata": {
92-
"description": "The name for the Cassandra Keyspace"
93-
}
94-
},
95-
"tableName": {
96-
"type": "string",
97-
"defaultValue": "Table1",
98-
"metadata": {
99-
"description": "The name for the Cassandra table"
100-
}
101-
},
102-
"throughput": {
103-
"type": "int",
104-
"defaultValue": 400,
105-
"minValue": 400,
106-
"maxValue": 1000000,
107-
"metadata": {
108-
"description": "The throughput for the Cassandra table"
109-
}
110-
}
111-
},
112-
"variables": {
113-
"accountName": "[toLower(parameters('accountName'))]",
114-
"consistencyPolicy": {
115-
"Eventual": {
116-
"defaultConsistencyLevel": "Eventual"
117-
},
118-
"ConsistentPrefix": {
119-
"defaultConsistencyLevel": "ConsistentPrefix"
120-
},
121-
"Session": {
122-
"defaultConsistencyLevel": "Session"
123-
},
124-
"BoundedStaleness": {
125-
"defaultConsistencyLevel": "BoundedStaleness",
126-
"maxStalenessPrefix": "[parameters('maxStalenessPrefix')]",
127-
"maxIntervalInSeconds": "[parameters('maxIntervalInSeconds')]"
128-
},
129-
"Strong": {
130-
"defaultConsistencyLevel": "Strong"
131-
}
132-
},
133-
"locations":
134-
[
135-
{
136-
"locationName": "[parameters('primaryRegion')]",
137-
"failoverPriority": 0,
138-
"isZoneRedundant": false
139-
},
140-
{
141-
"locationName": "[parameters('secondaryRegion')]",
142-
"failoverPriority": 1,
143-
"isZoneRedundant": false
144-
}
145-
]
146-
},
147-
"resources":
148-
[
149-
{
150-
"type": "Microsoft.DocumentDB/databaseAccounts",
151-
"name": "[variables('accountName')]",
152-
"apiVersion": "2020-03-01",
153-
"location": "[parameters('location')]",
154-
"kind": "GlobalDocumentDB",
155-
"properties": {
156-
"capabilities": [{ "name": "EnableCassandra" }],
157-
"consistencyPolicy": "[variables('consistencyPolicy')[parameters('defaultConsistencyLevel')]]",
158-
"locations": "[variables('locations')]",
159-
"databaseAccountOfferType": "Standard",
160-
"enableAutomaticFailover": "[parameters('automaticFailover')]"
161-
}
162-
},
163-
{
164-
"type": "Microsoft.DocumentDB/databaseAccounts/cassandraKeyspaces",
165-
"name": "[concat(variables('accountName'), '/', parameters('keyspaceName'))]",
166-
"apiVersion": "2020-03-01",
167-
"dependsOn": [ "[resourceId('Microsoft.DocumentDB/databaseAccounts/', variables('accountName'))]" ],
168-
"properties":{
169-
"resource":{
170-
"id": "[parameters('keyspaceName')]"
171-
}
172-
}
173-
},
174-
{
175-
"type": "Microsoft.DocumentDb/databaseAccounts/cassandraKeyspaces/tables",
176-
"name": "[concat(variables('accountName'), '/', parameters('keyspaceName'), '/', parameters('tableName'))]",
177-
"apiVersion": "2020-03-01",
178-
"dependsOn": [ "[resourceId('Microsoft.DocumentDB/databaseAccounts/cassandraKeyspaces', variables('accountName'), parameters('keyspaceName'))]" ],
179-
"properties":
180-
{
181-
"resource":{
182-
"id": "[parameters('tableName')]",
183-
"schema": {
184-
"columns": [
185-
{ "name": "loadid", "type": "uuid" },
186-
{ "name": "machine", "type": "uuid" },
187-
{ "name": "cpu", "type": "int" },
188-
{ "name": "mtime", "type": "int" },
189-
{ "name": "load", "type": "float" }
190-
],
191-
"partitionKeys": [
192-
{ "name": "machine" },
193-
{ "name": "cpu" },
194-
{ "name": "mtime" }
195-
],
196-
"clusterKeys": [
197-
{ "name": "loadid", "orderBy": "asc" }
198-
]
199-
},
200-
"options": { "throughput": "[parameters('throughput')]" }
201-
}
202-
}
203-
}
204-
]
205-
}
206-
```
207-
208-
## Deploy with the Azure CLI
209-
210-
To deploy the Azure Resource Manager template using the Azure CLI, **Copy** the script and select **Try it** to open Azure Cloud Shell. To paste the script, right-click the shell, and then select **Paste**:
211-
212-
```azurecli-interactive
213-
214-
read -p 'Enter the Resource Group name: ' resourceGroupName
215-
read -p 'Enter the location (i.e. westus2): ' location
216-
read -p 'Enter the account name: ' accountName
217-
read -p 'Enter the primary region (i.e. westus2): ' primaryRegion
218-
read -p 'Enter the secondary region (i.e. eastus2): ' secondaryRegion
219-
read -p 'Enter the keyspace name: ' keyspaceName
220-
read -p 'Enter the table name: ' tableName
221-
read -p 'Enter the throughput: ' throughput
222-
223-
az group create --name $resourceGroupName --location $location
224-
az group deployment create --resource-group $resourceGroupName \
225-
--template-uri https://raw.githubusercontent.com/azure/azure-quickstart-templates/master/101-cosmosdb-cassandra/azuredeploy.json \
226-
--parameters accountName=$accountName primaryRegion=$primaryRegion secondaryRegion=$secondaryRegion keyspaceName=$keyspaceName \
227-
tableName=$tableName throughput=$throughput
228-
229-
az cosmosdb show --resource-group $resourceGroupName --name accountName --output tsv
230-
```
231-
232-
The `az cosmosdb show` command shows the newly created Azure Cosmos account after it has been provisioned. If you choose to use a locally installed version of the Azure CLI instead of using Cloud Shell, see the [Azure CLI](/cli/azure/) article.
13+
In this article, you learn how to use Azure Resource Manager templates to help deploy and manage your Azure Cosmos DB accounts, keyspaces, and tables.
14+
15+
This article has examples for Cassandra API accounts only, to find examples for other API type accounts see: use Azure Resource Manager templates with Azure Cosmos DB's API for [SQL](manage-sql-with-resource-manager.md), [Gremlin](manage-gremlin-with-resource-manager.md), [MongoDB](manage-mongodb-with-resource-manager.md), [Table](manage-table-with-resource-manager.md) articles.
16+
17+
> [!IMPORTANT]
18+
>
19+
> * When you add or remove locations to an Azure Cosmos account, you can't simultaneously modify other properties. These operations must be done separately.
20+
> * Account names are limited to 44 characters, all lowercase.
21+
> * To change the throughput values, redeploy the template with updated RU/s.
22+
23+
To create any of the Azure Cosmos DB resources below, copy the following example template into a new json file. You can optionally create a parameters json file to use when deploying multiple instances of the same resource with different names and values. There are many ways to deploy Azure Resource Manager templates including, [Azure Portal](../azure-resource-manager/templates/deploy-portal.md), [Azure CLI](../azure-resource-manager/templates/deploy-cli.md), [Azure PowerShell](../azure-resource-manager/templates/deploy-powershell.md) and [GitHub](../azure-resource-manager/templates/deploy-to-azure-button.md).
24+
25+
<a id="create-autoscale"></a>
26+
27+
## Create Azure Cosmos account for Cassandra, keyspace and table with autoscale
28+
29+
This template creates an Azure Cosmos account in two regions with options for consistency and failover, with a keyspace and table configured for autoscale throughput. This template is also available for one-click deploy from Azure Quickstart Templates Gallery.
30+
31+
[![Deploy to Azure](https://aka.ms/deploytoazurebutton)](https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2FAzure%2Fazure-quickstart-templates%2Fmaster%2F101-cosmosdb-cassandra-autosscale%2Fazuredeploy.json)
32+
33+
:::code language="json" source="~/quickstart-templates/101-cosmosdb-cassandra-autoscale/azuredeploy.json":::
34+
35+
<a id="create-manual"></a>
36+
37+
## Create Azure Cosmos account, keyspace and table
38+
39+
This template creates an Azure Cosmos account in two regions with options for consistency and failover, with a keyspace and table configured for manual throughput. This template is also available for one-click deploy from Azure Quickstart Templates Gallery.
40+
41+
[![Deploy to Azure](https://aka.ms/deploytoazurebutton)](https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2FAzure%2Fazure-quickstart-templates%2Fmaster%2F101-cosmosdb-cassandra%2Fazuredeploy.json)
42+
43+
:::code language="json" source="~/quickstart-templates/101-cosmosdb-cassandra/azuredeploy.json":::
23344

23445
## Next steps
23546

23647
Here are some additional resources:
23748

238-
- [Azure Resource Manager documentation](/azure/azure-resource-manager/)
239-
- [Azure Cosmos DB resource provider schema](/azure/templates/microsoft.documentdb/allversions)
240-
- [Azure Cosmos DB Quickstart templates](https://azure.microsoft.com/resources/templates/?resourceType=Microsoft.DocumentDB&pageNumber=1&sort=Popular)
241-
- [Troubleshoot common Azure Resource Manager deployment errors](../azure-resource-manager/templates/common-deployment-errors.md)
49+
* [Azure Resource Manager documentation](/azure/azure-resource-manager/)
50+
* [Azure Cosmos DB resource provider schema](/azure/templates/microsoft.documentdb/allversions)
51+
* [Azure Cosmos DB Quickstart templates](https://azure.microsoft.com/resources/templates/?resourceType=Microsoft.DocumentDB&pageNumber=1&sort=Popular)
52+
* [Troubleshoot common Azure Resource Manager deployment errors](../azure-resource-manager/templates/common-deployment-errors.md)

0 commit comments

Comments
 (0)