Skip to content

Dougoc/cosmosdb-backup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

External Backup and Restore CosmosDB CLI

Project to backup CosmosDB to file and restore to another CosmosDB Server.

Starting

  • Clone this repo

  • Create venv and active

python3 -m venv env
source env/bin/activate
  • install dependencys
pip install -r requirements.txt
  • Use

GET DB Info

RES_GROUP=<resource-group-name>
ACCT_NAME=<cosmos-db-account-name>

export ACCOUNT_URI=$(az cosmosdb show --resource-group $RES_GROUP --name $ACCT_NAME --query documentEndpoint --output tsv)
export ACCOUNT_KEY=$(az cosmosdb list-keys --resource-group $RES_GROUP --name $ACCT_NAME --query primaryMasterKey --output tsv)

Backup

python3 -m main backup --container $COSMOSDB_CONTAINER --database $COSMOSDB_DB --host $ACCOUNT_URI --key ACCOUNT_KEY

Restore

python3 -m main restore --container $COSMOSDB_CONTAINER --database $COSMOSDB_DB --host $COSMOSDB_URI --key $COSMOSDB_KEY

If Container or database not exist, they will be created in restore process

TODO

  • More easy cli
  • Install instructions

About

Easy external CosmosDB backup and restore

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages