-
Notifications
You must be signed in to change notification settings - Fork 384
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
131 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,6 +47,33 @@ Prior to sending the document change to BigQuery, you have an opportunity to tra | |
|
||
The response should be indentical in structure. | ||
|
||
#### Using Customer Managed Encryption Keys | ||
|
||
By default, BigQuery encrypts your content stored at rest. BigQuery handles and manages this default encryption for you without any additional actions on your part. | ||
|
||
If you want to control encryption yourself, you can use customer-managed encryption keys (CMEK) for BigQuery. Instead of Google managing the key encryption keys that protect your data, you control and manage key encryption keys in Cloud KMS. | ||
|
||
For more general information on this, see [the docs](https://cloud.google.com/bigquery/docs/customer-managed-encryption). | ||
|
||
To use CMEK and the Key Management Service (KMS) with this extension | ||
1. [Enable the KMS API in your Google Cloud Project](https://console.cloud.google.com/apis/enableflow?apiid=cloudkms.googleapis.com). | ||
2. Create a keyring and keychain in the KMS. Note that the region of the keyring and key *must* match the region of your bigquery dataset | ||
3. Grant the BigQuery service account permission to encrypt and decrypt using that key. The Cloud KMS CryptoKey Encrypter/Decrypter role grants this permission. First find your project number. You can find this for example on the cloud console dashboard `https://console.cloud.google.com/home/dashboard?project={PROJECT_ID}`. The service account which needs the Encrypter/Decrypter role is then `[email protected]`. You can grant this role through the credentials service in the console, or through the CLI: | ||
``` | ||
gcloud kms keys add-iam-policy-binding \ | ||
--project=KMS_PROJECT_ID \ | ||
--member serviceAccount:[email protected] \ | ||
--role roles/cloudkms.cryptoKeyEncrypterDecrypter \ | ||
--location=KMS_KEY_LOCATION \ | ||
--keyring=KMS_KEY_RING \ | ||
KMS_KEY | ||
``` | ||
4. When installing this extension, enter the resource name of your key. It will look something like the following: | ||
``` | ||
projects/<YOUR PROJECT ID>/locations/<YOUR REGION>/keyRings/<YOUR KEY RING NAME>/cryptoKeys/<YOUR KEY NAME> | ||
``` | ||
If you follow these steps, your changelog table should be created using your customer-managed encryption. | ||
|
||
#### Backfill your BigQuery dataset | ||
|
||
This extension only sends the content of documents that have been changed -- it does not export your full dataset of existing documents into BigQuery. So, to backfill your BigQuery dataset with all the documents in your collection, you can run the [import script](https://github.com/firebase/extensions/blob/master/firestore-bigquery-export/guides/IMPORT_EXISTING_DOCUMENTS.md) provided by this extension. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,6 +55,33 @@ Prior to sending the document change to BigQuery, you have an opportunity to tra | |
|
||
The response should be indentical in structure. | ||
|
||
#### Using Customer Managed Encryption Keys | ||
|
||
By default, BigQuery encrypts your content stored at rest. BigQuery handles and manages this default encryption for you without any additional actions on your part. | ||
|
||
If you want to control encryption yourself, you can use customer-managed encryption keys (CMEK) for BigQuery. Instead of Google managing the key encryption keys that protect your data, you control and manage key encryption keys in Cloud KMS. | ||
|
||
For more general information on this, see [the docs](https://cloud.google.com/bigquery/docs/customer-managed-encryption). | ||
|
||
To use CMEK and the Key Management Service (KMS) with this extension | ||
1. [Enable the KMS API in your Google Cloud Project](https://console.cloud.google.com/apis/enableflow?apiid=cloudkms.googleapis.com). | ||
2. Create a keyring and keychain in the KMS. Note that the region of the keyring and key *must* match the region of your bigquery dataset | ||
3. Grant the BigQuery service account permission to encrypt and decrypt using that key. The Cloud KMS CryptoKey Encrypter/Decrypter role grants this permission. First find your project number. You can find this for example on the cloud console dashboard `https://console.cloud.google.com/home/dashboard?project={PROJECT_ID}`. The service account which needs the Encrypter/Decrypter role is then `[email protected]`. You can grant this role through the credentials service in the console, or through the CLI: | ||
``` | ||
gcloud kms keys add-iam-policy-binding \ | ||
--project=KMS_PROJECT_ID \ | ||
--member serviceAccount:[email protected] \ | ||
--role roles/cloudkms.cryptoKeyEncrypterDecrypter \ | ||
--location=KMS_KEY_LOCATION \ | ||
--keyring=KMS_KEY_RING \ | ||
KMS_KEY | ||
``` | ||
4. When installing this extension, enter the resource name of your key. It will look something like the following: | ||
``` | ||
projects/<YOUR PROJECT ID>/locations/<YOUR REGION>/keyRings/<YOUR KEY RING NAME>/cryptoKeys/<YOUR KEY NAME> | ||
``` | ||
If you follow these steps, your changelog table should be created using your customer-managed encryption. | ||
|
||
#### Backfill your BigQuery dataset | ||
|
||
This extension only sends the content of documents that have been changed -- it does not export your full dataset of existing documents into BigQuery. So, to backfill your BigQuery dataset with all the documents in your collection, you can run the [import script](https://github.com/firebase/extensions/blob/master/firestore-bigquery-export/guides/IMPORT_EXISTING_DOCUMENTS.md) provided by this extension. | ||
|
@@ -77,8 +104,6 @@ To install an extension, your project must be on the [Blaze (pay as you go) plan | |
|
||
**Configuration Parameters:** | ||
|
||
* Cloud Functions location: Where do you want to deploy the functions created for this extension? You usually want a location close to your database. For help selecting a location, refer to the [location selection guide](https://firebase.google.com/docs/functions/locations). | ||
|
||
* BigQuery Dataset location: Where do you want to deploy the BigQuery dataset created for this extension? For help selecting a location, refer to the [location selection guide](https://cloud.google.com/bigquery/docs/locations). | ||
|
||
* Project Id: Override the default project bigquery instance. This can allow updates to be directed to a bigquery instance on another project. | ||
|
@@ -102,18 +127,26 @@ To install an extension, your project must be on the [Blaze (pay as you go) plan | |
|
||
* BigQuery SQL table clustering: This parameter will allow you to set up Clustering for the BigQuery Table created by the extension. (for example: `data,document_id,timestamp`- no whitespaces). You can select up to 4 comma separated fields. The order of the specified columns determines the sort order of the data. Available schema extensions table fields for clustering: `document_id, timestamp, event_id, operation, data`. | ||
|
||
* Maximum number of synced documents per second: This parameter will set the maximum number of syncronised documents per second with BQ. Please note, any other external updates to a Big Query table will be included within this quota. Ensure that you have a set a low enough number to componsate. Defaults to 10. | ||
|
||
* Backup Collection Name: This (optional) parameter will allow you to specify a collection for which failed BigQuery updates will be written to. | ||
|
||
* Transform function URL: Specify a function URL to call that will transform the payload that will be written to BigQuery. See the pre-install documentation for more details. | ||
|
||
* Use new query syntax for snapshots: If enabled, snapshots will be generated with the new query syntax, which should be more performant, and avoid potential resource limitations. | ||
|
||
* Cloud KMS key name: Instead of Google managing the key encryption keys that protect your data, you control and manage key encryption keys in Cloud KMS. If this parameter is set, the extension will specify the KMS key name when creating the BQ table. See the PREINSTALL.md for more details. | ||
|
||
|
||
|
||
**Cloud Functions:** | ||
|
||
* **fsexportbigquery:** Listens for document changes in your specified Cloud Firestore collection, then exports the changes into BigQuery. | ||
|
||
* **syncBigQuery:** A task-triggered function that gets called on BigQuery sync | ||
|
||
* **setupBigQuerySync:** Runs configuration for sycning with BigQuery | ||
|
||
|
||
|
||
**APIs Used**: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
firestore-bigquery-export/firestore-bigquery-change-tracker/package-lock.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,7 +13,7 @@ | |
"author": "Jan Wyszynski <[email protected]>", | ||
"license": "Apache-2.0", | ||
"dependencies": { | ||
"@firebaseextensions/firestore-bigquery-change-tracker": "^1.1.26", | ||
"@firebaseextensions/firestore-bigquery-change-tracker": "^1.1.27", | ||
"@google-cloud/bigquery": "^4.7.0", | ||
"@types/chai": "^4.1.6", | ||
"@types/express-serve-static-core": "4.17.30", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 18 additions & 18 deletions
36
firestore-bigquery-export/scripts/gen-schema-view/package-lock.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.