By Fatskills Exam Guides Team — the exam nerds behind 28,500+ quizzes and 2.1M practice questions across 500+ global exams.
This topic covers how to secure ML workloads on Google Cloud by controlling network access, encrypting data at rest, and managing identities for services. Imagine a healthcare startup training a Vertex AI model on sensitive patient records. They need to: - Block unauthorized access to training data stored in Cloud Storage (VPC Service Controls).- Ensure encryption keys are managed by their security team (CMEK).- Let Vertex AI Pipelines access BigQuery without hardcoding service account keys (Workload Identity).Without these, data leaks, compliance violations, or credential theft could derail the project.
Scenario: A fintech company wants to block unauthorized access to BigQuery datasets containing transaction records.1. Create a service perimeter in VPC Service Controls: - Go to Security → VPC Service Controls in the GCP Console. - Click Create Perimeter and select the projects/services to protect (e.g., bigquery.googleapis.com).2. Define access levels (optional): - Restrict access to corporate IPs or specific VPCs using Access Levels (e.g., corp-ip-range).3. Test the perimeter: - Try accessing BigQuery from an unauthorized VPC or IP. The request should be blocked with an error like PERMISSION_DENIED: VPC Service Controls.4. Add exceptions (if needed): - Use Ingress/Egress Rules to allow specific projects or services (e.g., let Vertex AI access BigQuery).
bigquery.googleapis.com
corp-ip-range
PERMISSION_DENIED: VPC Service Controls
Scenario: A healthcare provider needs to encrypt Cloud Storage buckets storing patient X-rays with their own keys.1. Create a key ring and key in Cloud KMS: - Go to Security → Key Management and create a key ring (e.g., ml-keys) and a key (e.g., patient-data-key). - Set rotation period (e.g., 90 days) for compliance.2. Grant permissions: - Assign the Cloud Storage Service Agent (service-[PROJECT_NUMBER]@gs-project-accounts.iam.gserviceaccount.com) the cloudkms.cryptoKeyEncrypterDecrypter role on the key.3. Enable CMEK on the bucket: - In Cloud Storage, create a bucket and select Customer-Managed Key under encryption. - Choose the KMS key you created.4. Verify encryption: - Upload a file and check its encryption status with: bash gsutil ls -L gs://your-bucket-name/your-file - Look for KMS key: projects/your-project/locations/global/keyRings/ml-keys/cryptoKeys/patient-data-key.
ml-keys
patient-data-key
service-[PROJECT_NUMBER]@gs-project-accounts.iam.gserviceaccount.com
cloudkms.cryptoKeyEncrypterDecrypter
bash gsutil ls -L gs://your-bucket-name/your-file
KMS key: projects/your-project/locations/global/keyRings/ml-keys/cryptoKeys/patient-data-key
Scenario: A Vertex AI Pipeline needs to read data from BigQuery without storing service account keys.1. Create a Google Service Account (GSA): - Go to IAM & Admin → Service Accounts and create a GSA (e.g., [email protected]). - Grant it the BigQuery Data Viewer role.2. Enable Workload Identity on the GKE cluster (if using Vertex AI Pipelines on GKE): - Edit the cluster and enable Workload Identity under Security.3. Bind the GSA to a Kubernetes Service Account (KSA): - Create a KSA in your GKE namespace (e.g., vertex-ai-ksa). - Bind the GSA to the KSA with: bash gcloud iam service-accounts add-iam-policy-binding \ --role roles/iam.workloadIdentityUser \ --member "serviceAccount:your-project.svc.id.goog[default/vertex-ai-ksa]" \ [email protected] 4. Annotate the KSA: - Add the annotation to the KSA: yaml metadata: annotations: iam.gke.io/gcp-service-account: [email protected] 5. Test access: - Deploy a pod using the KSA and verify it can query BigQuery without explicit key files.
[email protected]
BigQuery Data Viewer
vertex-ai-ksa
bash gcloud iam service-accounts add-iam-policy-binding \ --role roles/iam.workloadIdentityUser \ --member "serviceAccount:your-project.svc.id.goog[default/vertex-ai-ksa]" \ [email protected]
yaml metadata: annotations: iam.gke.io/gcp-service-account: [email protected]
A financial services company wants to train a Vertex AI model on transaction data stored in BigQuery. They need to: - Block unauthorized access to the data, even if IAM permissions are misconfigured.- Ensure the data is encrypted with keys managed by their security team.Which two GCP services should they use? Answer: VPC Service Controls (to block unauthorized access) and CMEK (to encrypt data with customer-managed keys).Explanation: VPC-SC prevents data exfiltration at the network level, while CMEK provides control over encryption keys.
A Vertex AI Pipeline running on GKE needs to read data from BigQuery. The security team prohibits storing service account keys in the cluster. What should you use? Answer: Workload Identity.Explanation: Workload Identity securely grants the GKE pods access to BigQuery using short-lived credentials, without static keys.
A healthcare startup is deploying a Vertex AI Endpoint for a model that processes patient records. They need to ensure: - The model’s predictions are encrypted in transit.- The training data is encrypted at rest with keys they control.- The endpoint is only accessible from their corporate network.Which three GCP features should they configure? Answer:1. TLS (for encrypting predictions in transit).2. CMEK (for encrypting training data at rest with customer-managed keys).3. Private Service Connect (to restrict endpoint access to their corporate network).Explanation: TLS encrypts traffic, CMEK encrypts data at rest, and Private Service Connect enables private access.
Join 4M+ learners. Unlock unlimited quizzes, wrong-answer tracking, flashcards + reminders, study guides, and 1-on-1 challenges.