Migrating BigQuery Data to CMEK with Pub/Sub Ingestion

PDE By islever Editorial Last updated

Designing for security and compliance.

Short answer

B Create a new BigQuery table by using customer-managed encryption keys (CMEK), and migrate the data from the old BigQuery table.

Question

You have a BigQuery table that ingests data directly from a Pub/Sub subscription. The ingested data is encrypted with a Google-managed encryption key. You need to meet a new organization policy that requires you to use keys from a centralized Cloud Key Management Service (Cloud KMS) project to encrypt data at rest. What should you do?
  1. Use Cloud KMS encryption key with Dataflow to ingest the existing Pub/Sub subscription to the existing BigQuery table.
  2. Create a new BigQuery table by using customer-managed encryption keys (CMEK), and migrate the data from the old BigQuery table. Correct Answer
  3. Create a new Pub/Sub topic with CMEK and use the existing BigQuery table by using Google-managed encryption key.
  4. Create a new BigQuery table and Pub/Sub topic by using customer-managed encryption keys (CMEK), and migrate the data from the old BigQuery table.

Key Takeaways

The main trap is assuming Pub/Sub supports CMEK; it does not. The exam tests your knowledge that you can only enforce CMEK at the BigQuery storage level by creating a new table and migrating data.

Learn how to meet organization policies requiring CMEK for BigQuery data at rest when ingesting from Pub/Sub. Since Pub/Sub lacks CMEK support, the correct solution involves creating a new BigQuery table with CMEK and migrating data.

Common mistake: Option D is the most plausible wrong answer. Candidates choose it because they want to secure both ingestion and storage with CMEK. However, this is incorrect because Pub/Sub topics cannot be configured with CMEK, making the action described in D impossible.

Expert Analysis

The core of this question hinges on understanding the scope of encryption capabilities in Google Cloud services and which components support Customer-Managed Encryption Keys (CMEK).

BigQuery Storage Encryption: BigQuery allows you to encrypt data at rest using either Google-managed keys or CMEK. To switch from Google-managed keys to CMEK, you cannot simply update an existing table's configuration. You must create a new table with the desired CMEK and migrate the data into it. This eliminates any option that suggests updating the existing table in place.

Pub/Sub Encryption Capabilities: A critical technical constraint often missed is that Pub/Sub topics and subscriptions do not support CMEK. Pub/Sub encrypts data at rest using Google-managed keys by default, and there is no mechanism to configure a Pub/Sub topic to use a specific key from Cloud KMS. Therefore, any option suggesting the creation of a Pub/Sub topic with CMEK is technically impossible.

Evaluating the Options:

  • Option B correctly identifies that you need to create a new BigQuery table with CMEK and migrate the data. It implicitly accepts that Pub/Sub encryption remains as-is (Google-managed) because that is the only supported state for Pub/Sub. The requirement is to ensure the ingested data (now residing in BigQuery) is encrypted with CMEK. Since Pub/Sub cannot be changed, the solution focuses on the storage layer where the compliance requirement can actually be met.
  • Options A, C, and D are incorrect because they involve actions that are either technically unsupported (A: Dataflow doesn't change existing table encryption; C & D: Pub/Sub does not support CMEK). Option D is a common distractor because it sounds comprehensive, but it relies on a false premise about Pub/Sub capabilities.

The comments show significant confusion, with many users voting for D due to the desire for 'end-to-end' security. However, certification exams test against official service limitations. Since Pub/Sub cannot use CMEK, creating a CMEK-enabled Pub/Sub topic is not a valid action. The correct approach is to secure the data at its resting place in BigQuery.

Exam Strategy

Always verify if a specific cloud service supports the feature being tested before selecting an option. For encryption questions, check the 'Data at Rest' and 'Data in Transit' capabilities for each component mentioned. If a component like Pub/Sub does not support CMEK, discard any option that requires configuring CMEK for that component, even if it seems logically desirable for security.

Frequently Asked Questions

Can I enable CMEK on an existing BigQuery table?

No. To use CMEK, you must create a new table with the CMEK configuration and migrate the data from the old table. You cannot retroactively apply CMEK to an existing table.

Does Pub/Sub support Customer-Managed Encryption Keys (CMEK)?

No. Pub/Sub topics and subscriptions always use Google-managed encryption keys for data at rest. There is no option to configure CMEK for Pub/Sub.

More PDE FAQ →

Community Votes

B
58%
D
42%

58% of anonymous learners picked answer B. Votes are pick records left by other test-takers — they are not the verified answer.

Discussion 38 contributions

Compiled from public community threads and reader submissions, lightly edited for clarity. Handles and vote tallies are shown as recorded, and comments reflect the views of individual contributors.

From public community threads 30 of 38

  1. raaad 👍 11 Answered B
    - New BigQuery Table with CMEK: This option involves creating a new BigQuery table configured to use a CMEK from Cloud KMS. It directly addresses the need to use a CMEK for data at rest in BigQuery. - Migrate Data: Migrating data from the old table (encrypted with a Google-managed key) to the new table (encrypted with CMEK) ensures that all existing data complies with the new policy.
  2. Matt_108 👍 9 Answered D
    Option D - I get the discussion about B and D, but also pub/sub has some data at rest, e.g. messages with retention period. To comply with the organisation policy, we need to adapt also pub/sub
  3. Matt_108 👍 6
    But also pub/sub has some data at rest, e.g. messages with retention period. To comply with the organisation policy, we need to adapt also pub/sub
  4. Anudeep58 👍 3 Answered D
    D. Create a new BigQuery table and Pub/Sub topic by using customer-managed encryption keys (CMEK), and migrate the data from the old BigQuery table. This approach comprehensively addresses the requirement to use CMEK from a centralized Cloud KMS project for encrypting data at rest: Create a new Pub/Sub topic configured to use CMEK from the centralized Cloud KMS project. Create a new BigQuery table with CMEK enabled, using the same centralized Cloud KMS project. Update the ingestion process to use the new Pub/Sub topic to feed data into the new BigQuery table. Migrate existing data from the old BigQuery table to the new BigQuery table to ensure all data complies with the new encryption policy.
  5. ML6 👍 3
    Only option D complies with the organisation policy: - By creating a new Pub/Sub topic with customer-managed encryption keys (CMEK), any new data ingested into Pub/Sub will be encrypted with the (!) organization's desired encryption keys (!). - Creating a new BigQuery table with CMEK ensures that all data stored in BigQuery, both newly ingested and migrated historical data, is encrypted according to organizational policies. - Migrating the data from the old BigQuery table to the new one ensures that historical data is also encrypted with the new keys, thus meeting the organization's requirements for encryption at rest for both Pub/Sub and BigQuery.
Show 25 more comments
  1. Izzyt99 👍 3
    D - 'as new organization policy that requires you to use keys from a centralized Cloud Key Management Service (Cloud KMS) project to encrypt data at rest.' Therefore, the Pub/Sub default Google-managed encryption key is not sufficient as the organization requires it's own CMEK that is to be generated from a centralized Cloud KMS project.
  2. Smakyel79 👍 3 Answered D
    This option ensures that both the ingestion mechanism (Pub/Sub) and the storage component (BigQuery) are aligned with the organization's policy of using CMEK, providing end-to-end encryption control.
  3. BIGQUERY_ALT_ALT 👍 3
    Requirement is encrypt bq data - " The ingested data is encrypted with a Google-managed encryption key" so pubsub encryption from ingestion is not needed. Option B is correct.
  4. Matt_108 👍 3
    to me it's D because also pub/sub has some data at rest, e.g. messages with retention period. To comply with the organisation policy, we need to adapt also pub/sub encryption
  5. josech 👍 3 Answered D
    BigQuery and Pub/Sub shall be encrypted using CMEK using new versions of each one. https://cloud.google.com/pubsub/docs/encryption#using-cmek
  6. ML6 👍 3
    Correct, but the question states 'use keys from a centralized Cloud KMS project', so only D is correct.
  7. GCP001 👍 3
    D. We should use new CMSK for both pubsub topic and BQ tables along with migrating old data.
  8. carmltekai 👍 2 Answered B
    "The best solution here is B. Create a new BigQuery table by using customer-managed encryption keys (CMEK), and migrate the data from the old BigQuery table. Here's why: Customer-Managed Encryption Keys (CMEK): CMEKs allow you to have granular control over your encryption keys, complying with the organization's policy to use keys from a centralized Cloud KMS project. Data Migration: Since the data in the existing table is already encrypted with a Google-managed key, you cannot retroactively change the encryption key for that table. Migrating the data to a new table with the correct encryption is the most efficient way to meet compliance.
  9. plum21 👍 2 Answered D
    There is data at rest in Pub/Sub, which is stated here in the docs: https://cloud.google.com/pubsub/docs/encryption At rest data -> Application layer -> CMEK encryption
  10. raaad 👍 2
    I think option A is a partial solution as using Cloud KMS key in Dataflow for ingestion does not change the encryption of the data at rest in the BigQuery table.
  11. LaxmanTiwari 👍 2 Answered B
    B. Create a new BigQuery table by using customer-managed encryption keys (CMEK), and migrate the data from the old BigQuery table. Most Voted
  12. AllenChen123 👍 2
    No, "The ingested data is encrypted with a Google-managed encryption key", target is ingested data in BigQuery.
  13. chrissamharris 👍 2 Answered B
    Data at rest in requirement = Big Query ONLY. Pub/Sub is data in movement - overkill for the solution
  14. raaad 👍 2
    Configuring a Pub/Sub topic with a CMEK is not necessary for encrypting data at rest in BigQuery.
  15. SamuelTsch 👍 2 Answered B
    should be B. Pub/Sub is not designed for storing data at rest.
  16. ML6 👍 2
    But they mention that ingested data is already encrypted?
  17. AlizCert 👍 2 Answered B
    B, been there, done that...
  18. gr3yWind 👍 2 Answered B
    Agree with raaad
  19. AlizCert 👍 2
    sry, I mean D
  20. raaad 👍 2
    Why not B??
  21. carbonscave 👍 1 Answered B
    Why B is the right move Targeting the Data at Rest: The prompt explicitly states that "the ingested data is encrypted with a Google-managed encryption key." This points specifically to the data resting long-term inside the BigQuery table. To comply with the new centralized Cloud KMS policy, you must transition this storage to Customer-Managed Encryption Keys (CMEK). The Migration Requirement: While you can update an existing BigQuery table's default KMS key for newly written data, doing so does not retroactively re-encrypt the existing historical data already resting on disk. To ensure 100% of the data complies with the new policy, the standard architectural pattern is to create a new CMEK-enabled table and execute a table copy or SQL SELECT * to migrate the historical data. The copy process encrypts the data with the new key as it writes it to the new destination.
  22. amanbawa96 👍 1 Answered B
    BigQuery allows you to encrypt data at rest using either Google-managed encryption keys or customer-managed encryption keys (CMEK) from Cloud KMS. Since the new policy requires using keys from a centralized Cloud KMS project, you need to create a new BigQuery table that is configured to use CMEK for encryption. After creating the new table with CMEK, you can migrate the data from the old table (encrypted with Google-managed keys) to the new table (encrypted with CMEK). This approach ensures that the data in the BigQuery table is encrypted using the required CMEK while preserving the existing data. Creating a new BigQuery table and Pub/Sub topic with CMEK is not necessary because the focus is on encrypting the data at rest in BigQuery. The existing Pub/Sub subscription can still be used to ingest data into the new BigQuery table.
  23. shanks_t 👍 1 Answered D
    Requirement for Cloud KMS keys: The new organization policy requires using keys from a centralized Cloud KMS project for encrypting data at rest. This necessitates the use of customer-managed encryption keys (CMEK). BigQuery table encryption: The existing BigQuery table is encrypted with a Google-managed key. To meet the new policy, a new table needs to be created with CMEK. Pub/Sub topic encryption: Since the data is ingested directly from a Pub/Sub subscription, the Pub/Sub topic also needs to use CMEK to ensure end-to-end encryption with customer-managed keys. Data migration: The existing data in the old BigQuery table needs to be migrated to the new CMEK-encrypted table to ensure all data complies with the new policy
  24. carmltekai 👍 1
    Why other options aren't suitable: A: Dataflow can't retroactively change the encryption of data that's already in BigQuery. C: Creating a new Pub/Sub topic with CMEK wouldn't address the data that's already in BigQuery. D: While creating a new Pub/Sub topic might be useful in the long run, it's not necessary for solving the immediate compliance issue with the existing data."
  25. m_a_p_s 👍 1 Answered B
    B. You don't need to create a new topic in order to use the new CMEK. Existing topic can be updated to use the new key: https://cloud.google.com/pubsub/docs/encryption#update_cmek_for_a_topic

Reader comments & corrections

No reader corrections yet — spotted an error or have a note? Share it below.

Log in to comment, report an error, or add a note about this question.

← Back to PDE Study Guide