You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
title: Scale Azure Cosmos DB on a schedule by using Azure Functions timer
3
3
description: Learn how to scale changes in throughput in Azure Cosmos DB using PowerShell and Azure Functions.
4
4
author: markjbrown
5
5
ms.service: cosmos-db
@@ -8,18 +8,19 @@ ms.date: 01/07/2020
8
8
ms.author: mjbrown
9
9
---
10
10
11
-
# Scale Azure Cosmos DB using Azure Functions Timer Trigger
11
+
# Scale Azure Cosmos DB throughput by using Azure Functions Timer trigger
12
12
13
-
Azure Cosmos DB performance is based on the amount of provisioned throughput expressed in Request Units per second (RU/s). The provisioning is at a second granularity and is billed based upon the highest RU/s per hour. This provisioned capacity model enables the service to provide a predictable and consistent throughput, guaranteed low latency, and high availability. In most production workloads this is necessary. However, in development and testing environments where Cosmos is only used during working hours, Cosmos can be scaled up in the morning and scaled back down in the evening after working hours.
14
13
15
-
Throughput can be set via [Azure Resource Manager (ARM) Templates](resource-manager-samples.md), [Azure CLI](cli-samples.md), [PowerShell](powershell-samples-sql.md), or for Core (SQL) API accounts, using the Cosmos SDK. The benefit for using ARM Templates, Azure CLI or PowerShell is they support all Cosmos DB model APIs.
14
+
The performance of an Azure Cosmos account is based on the amount of provisioned throughput expressed in Request Units per second (RU/s). The provisioning is at a second granularity and is billed based upon the highest RU/s per hour. This provisioned capacity model enables the service to provide a predictable and consistent throughput, guaranteed low latency, and high availability. Most production workloads these features. However, in development and testing environments where Azure Cosmos DB is only used during working hours, you can scale up the throughput in the morning and scale back down in the evening after working hours.
16
15
17
-
## Azure Cosmos DB throughput scheduler sample project
16
+
You can set the throughput via [Azure Resource Manager (ARM) Templates](resource-manager-samples.md), [Azure CLI](cli-samples.md), and [PowerShell](powershell-samples-sql.md), for Core (SQL) API accounts, or by using the language-specific Azure Cosmos DB SDKs. The benefit of using ARM Templates, Azure CLI or PowerShell is that they support all Azure Cosmos DB model APIs.
18
17
19
-
To simplify the process for scaling Azure Cosmos DB on a schedule we've created a sample project, [Azure Cosmos Throughput Scheduler](https://github.com/Azure-Samples/azure-cosmos-throughput-scheduler). This project is an Azure Functions app with two Timer Triggers, ScaleUpTrigger and ScaleDownTrigger. The triggers run a PowerShell script that set the throughput on each resource defined in the `scale.json` file in each trigger. The ScaleUpTrigger is configured to run at 8am UTC and the ScaleDownTrigger is configured to run at 6pm UTC and can be easily changed in the `function.json` for each trigger.
18
+
## Throughput scheduler sample project
20
19
21
-
This project can be cloned locally, modified to specify the Azure Cosmos DB resources to scale up and down and the schedule to run. Then deployed in an Azure subscription and secured using Managed Service Identity with [Role-based Access Control](role-based-access-control.md) (RBAC) permissions using the Cosmos DB Operator role to set throughput on your Azure Cosmos accounts.
20
+
To simplify the process to scale Azure Cosmos DB on a schedule we've created a sample project called [Azure Cosmos throughput scheduler](https://github.com/Azure-Samples/azure-cosmos-throughput-scheduler). This project is an Azure Functions app with two timer triggers- "ScaleUpTrigger" and "ScaleDownTrigger". The triggers run a PowerShell script that sets the throughput on each resource as defined in the `scale.json` file in each trigger. The ScaleUpTrigger is configured to run at 8 AM UTC and the ScaleDownTrigger is configured to run at 6 PM UTC and these times can be easily updated within the `function.json` file for each trigger.
21
+
22
+
You can clone this project locally, modify it to specify the Azure Cosmos DB resources to scale up and down and the schedule to run. Later you can deploy it in an Azure subscription and secure it using managed service identity with [Role-based Access Control](role-based-access-control.md) (RBAC) permissions with the "Azure Cosmos DB operator" role to set throughput on your Azure Cosmos accounts.
22
23
23
24
## Next Steps
24
25
25
-
- Learn more and download sample, [Azure Cosmos Throughput Scheduler](https://github.com/Azure-Samples/azure-cosmos-throughput-scheduler).
26
+
- Learn more and download the sample from [Azure Cosmos DB throughput scheduler](https://github.com/Azure-Samples/azure-cosmos-throughput-scheduler).
0 commit comments