Skip to content

Instantly share code, notes, and snippets.

View pkdone's full-sized avatar

Paul Done pkdone

View GitHub Profile

Hashicorp Vault Secrets For MongoDB Atlas Programmatic Admin API Keys Creation

Assumptions

  • You have a MongoDB Atlas project already created and you have made a note of its project/group ID
  • You have already created an Atlas org-level Admin API key which has an Access List configured to be accessible from your workstation and you have made a note of its public and private key values
  • You have Hashicorp Vault installed

Start Vault in Development Mode

MongoDB Encryption-at-Rest Using KMIP

Assumptions

  • You have MongoDB Enterprise installed (but not configured or running) on your local workstation with the mongod binary and the other MongoDB binaries on your system path
  • You have the modern MongoDB Shell (mongosh) installed locally on your workstation
  • You have a KMIP Server running and accessible (for an example of running and configuring a Hashicorp Vault development instance, see: Hashicorp Vault Configuration For MongoDB KMIP Use)

Create a Shell Script to Start an Encrypted Replica Set and Launch It

Hashicorp Vault Configuration For MongoDB KMIP Use

Assumptions

You have Hashicorp Vault enterprise version installed, which supports KMIP (the open-source version of Vault does not support KMIP).

Start Vault in Development Mode

From a terminal, execute the code below after first changing the variable VAULT_LICENSE_PATH to reference the location of your downloaded Hashicorp Vault enterprise licence:

MongoDB Client-Side Field Level Encryption (CSFLE) Using KMIP or Local Master Key (with mongosh)

Assumptions

  • You have a MongoDB Enterprise deployment already running and accessible (self-managed or in Atlas)
  • You have the MongoDB Enterprise binary mongocryptd accessibe on your system path to enable automated encryption
  • You have the modern MongoDB Shell (mongosh) installed locally on your workstation
  • You have a KMIP Server running and accessible, if you don't intend to use a local keyfile (for an example of running and configuring a Hashicorp Vault development instance, see: Hashicorp Vault Configuration For MongoDB KMIP Use)

Configure Local Workstation Context Files