justin.m.chase
justin.m.chase

Reputation: 13655

What is the right way to create tables in CosmosDB?

I am intending to use the nodejs and the Mongo API to interact with CosmosDB. I am using ARM templates to provision resources during deployment, in this case a CosmosDB and a Web App.

I am coming from an AWS background where you can use Cloud Formation to define DynamoDB tables and indexes and default throughput for these tables, but I'm having trouble finding out how to do this in an ARM template.

Am I expected to create tables through the ARM template? Or should I setup a migration script for this? What is the recommended way to facilitate automated deployment for CosmosDB?

Upvotes: 2

Views: 1263

Answers (1)

David Makogon
David Makogon

Reputation: 71028

You cannot create Cosmos DB collections via ARM templates; you may only use the ARM template to provision the database itself.

You'll need to create your collections either programmatically (via REST API, or one of the many SDK's), or via script (Azure CLI, PowerShell, etc), after your database is provisioned.

Upvotes: 1

Related Questions