Skip to content

Commit 9fddaef

Browse files
terakilobyteChris Cho
andauthored
add gcp and azure kms (#710)
* add gcp and azure kms * fix external link formatting * specify azure for azure kms data key creation * gcp to azure * Update source/includes/steps-fle-convert-to-a-remote-master-key-gcp.yaml Co-authored-by: Chris Cho <[email protected]> * pr feedback fixes Co-authored-by: Nathan Leniz <[email protected]> Co-authored-by: Chris Cho <[email protected]>
1 parent 7b939f9 commit 9fddaef

File tree

3 files changed

+69
-16
lines changed

3 files changed

+69
-16
lines changed

source/includes/steps-fle-convert-to-a-remote-master-key-aws.yaml

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,11 @@ content: |
9797
9898
kmsProviders = {
9999
aws: {
100-
accessKeyId: '<IAM User Access Key ID>',
101-
secretAccessKey: '<IAM User Secret Access Key>',
102-
}
100+
accessKeyId: "<IAM User Access Key ID>",
101+
secretAccessKey: "<IAM User Secret Access Key>",
102+
},
103103
}
104+
104105
.. tab::
105106
:tabid: python
106107
@@ -231,17 +232,17 @@ content: |
231232
232233
const encryption = new ClientEncryption(client, {
233234
keyVaultNamespace,
234-
kmsProviders
235+
kmsProviders,
235236
});
236-
const key = await encryption.createDataKey('aws', {
237+
const key = await encryption.createDataKey("aws", {
237238
masterKey: {
238-
key: '<Master Key ARN>', // e.g. 'arn:aws:kms:us-east-2:111122223333:alias/test-key'
239-
region: '<Master Key AWS Region>' // e.g. 'us-east-2'
240-
}
239+
key: "<Master Key ARN>", // e.g. "arn:aws:kms:us-east-2:111122223333:alias/test-key"
240+
region: "<Master Key AWS Region>", // e.g. "us-east-2"
241+
},
241242
});
242243
243-
const base64DataKeyId = key.toString('base64');
244-
console.log('DataKeyId [base64]: ', base64DataKeyId);
244+
const base64DataKeyId = key.toString("base64");
245+
console.log("DataKeyId [base64]: ", base64DataKeyId);
245246
246247
.. tab::
247248
:tabid: python

source/includes/steps-fle-convert-to-a-remote-master-key-azure.yaml

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,20 @@ content: |
115115
.. tab::
116116
:tabid: nodejs
117117
118+
.. code-block:: javascript
119+
120+
kmsProviders = {
121+
azure: {
122+
tenantId: "<Azure account organization>",
123+
clientId: "<Azure client ID>",
124+
clientSecret: "<Azure client secret>",
125+
},
126+
}
127+
118128
.. note::
119129
120-
The Node.js driver does not currently support Azure KMS.
130+
To use the Azure Key Vault, you must use ``mongodb-client-encryption`` version
131+
`1.1.1 <https://www.npmjs.com/package/mongodb-client-encryption/v/1.1.1-beta.0>`__ or later.
121132
122133
.. tab::
123134
:tabid: python
@@ -256,9 +267,22 @@ content: |
256267
.. tab::
257268
:tabid: nodejs
258269
259-
.. note::
270+
.. code-block:: javascript
271+
272+
const encryption = new ClientEncryption(client, {
273+
keyVaultNamespace,
274+
kmsProviders,
275+
});
276+
const key = await encryption.createDataKey("azure", {
277+
masterKey: {
278+
keyName: "<Azure key name>",
279+
keyVaultEndpoint: "<Azure key vault endpoint>",
280+
},
281+
});
282+
283+
const base64DataKeyId = key.toString("base64");
284+
console.log("DataKeyId [base64]: ", base64DataKeyId);
260285
261-
The Node.js driver does not currently support Azure KMS.
262286
263287
.. tab::
264288
:tabid: python

source/includes/steps-fle-convert-to-a-remote-master-key-gcp.yaml

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,20 @@ content: |
116116
.. tab::
117117
:tabid: nodejs
118118
119+
.. code-block:: javascript
120+
121+
kmsProviders = {
122+
gcp: {
123+
email: "<GCP service account email>",
124+
privateKey: "<GCP service account private key>",
125+
endpoint: "<GCP authentication endpoint>",
126+
},
127+
}
128+
119129
.. note::
120130
121-
The Node.js driver does not currently support GCP KMS.
131+
To use the GCP KMS, you must use ``mongodb-client-encryption`` version
132+
`1.1.1 <https://www.npmjs.com/package/mongodb-client-encryption/v/1.1.1-beta.0>`__ or later.
122133
123134
.. tab::
124135
:tabid: python
@@ -264,9 +275,26 @@ content: |
264275
.. tab::
265276
:tabid: nodejs
266277
267-
.. note::
268278
269-
The Node.js driver does not currently support GCP KMS.
279+
.. code-block:: javascript
280+
281+
const encryption = new ClientEncryption(client, {
282+
keyVaultNamespace,
283+
kmsProviders,
284+
});
285+
const key = await encryption.createDataKey("gcp", {
286+
masterKey: {
287+
projectId: "<GCP project identifier>",
288+
location: "<GCP region>",
289+
keyRing: "<GCP key ring name>",
290+
keyName: "<GCP key name>",
291+
keyVersion: "<GCP key version>",
292+
endpoint: "<GCP KMS API endpoint>",
293+
},
294+
});
295+
296+
const base64DataKeyId = key.toString("base64");
297+
console.log("DataKeyId [base64]: ", base64DataKeyId);
270298
271299
.. tab::
272300
:tabid: python

0 commit comments

Comments
 (0)