CosmosDB

(~20 minutes)

Why CosmosDB + MongoDB

CosmosDB is a good solution for building a solution for a startup, it allows solutions to start small and to scale globally, all with little management overhead. There are, of course drawbacks as well, the major one being that cost can be come an issue. This project will attempt to keep costs in check by fronting access to CosmosDB with Apollo GraphQL which if architected appropriately can make server side calls more efficient and can leverage caching.

The NodeJS community has excellent support for MongoDB and the maturity in working with unstructured data provides a good paring with Apollo GraphQL and helps to meet the demands of modern consumer created data driven applications.

Set up an instance of CosmosDB

  • Navigate to the Create Azure CosmosDB Account in the Azure portal

  • Select the appropriate Subscription

  • Select the rg-sharethrift resource group

  • Instance Details:

    • Account Name: sharethrift<<Random Number>>

    • API: Azure CosmosDB for MogodDB API

    • Notebooks (Preview): On

    • Location: (US) East US 2

    • Apply Free Tier Discount: Apply

    • Account Type: Production

    • Version: 4.2

    • Multi-region Writes: Enable (may want to Disable for lower cost)

    • Availability Zones: Enable

    • Click Next: Networking

  • Networking

    • Network Connectivity - Connectivity method: All networks Public endpoint (selected networks)

    • Configure Firewall

      • Allow access from Azure Portal: Allow

      • Allow access from my IP: Allow

    • Click Review + create

    • Click Create (wait for completion)

  • Click Data Explorer

    • Choose New Database (Pane will show)

      • Database ID: sharethrift

      • Provision throughput: Checked

        • Important: This allows each collection to share in the 1,000 RU allotment for the free tier.

      • Database Throughput(autoscale):Autoscale

      • Max R/Us: (leave default 1,000 )

      • Click OK

Last updated