Bird
Raised Fist0
GCPcloud~10 mins

VPC Service Controls in GCP - Step-by-Step Execution

Choose your learning style10 modes available
Process Flow - VPC Service Controls
Start: Define Service Perimeter
↓
Select Google Cloud Services
↓
Add Resources to Perimeter
↓
Enforce Access Restrictions
↓
Monitor Access & Logs
↓
Adjust Perimeter as Needed
↓
End
This flow shows how you create a secure boundary around your cloud resources by defining a perimeter, selecting services, adding resources, enforcing restrictions, monitoring, and adjusting.
Execution Sample
GCP
gcloud access-context-manager perimeters create perimeter-1 \
  --title="My Perimeter" \
  --resources=projects/123456789 \
  --restricted-services=storage.googleapis.com,bigquery.googleapis.com
This command creates a service perimeter named 'perimeter-1' that restricts access to Storage and BigQuery for the specified project.
Process Table
StepActionInput/CommandResult/State Change
1Define PerimeterCreate perimeter-1 with title 'My Perimeter'Perimeter 'perimeter-1' created
2Select ServicesRestrict services: storage.googleapis.com, bigquery.googleapis.comServices restricted inside perimeter
3Add ResourcesAdd project 123456789 to perimeterProject added to perimeter
4Enforce RestrictionsApply perimeter policiesAccess to restricted services limited to perimeter
5Monitor AccessCheck audit logs for perimeter accessLogs show allowed and denied access attempts
6Adjust PerimeterAdd another project or servicePerimeter updated with new resources
7ExitNo more changesPerimeter enforces access controls as configured
💡 No more perimeter changes; access controls active
Status Tracker
VariableStartAfter Step 1After Step 2After Step 3After Step 4After Step 5After Step 6Final
Perimeter NameNoneperimeter-1perimeter-1perimeter-1perimeter-1perimeter-1perimeter-1perimeter-1
Restricted ServicesNoneNonestorage.googleapis.com, bigquery.googleapis.comstorage.googleapis.com, bigquery.googleapis.comstorage.googleapis.com, bigquery.googleapis.comstorage.googleapis.com, bigquery.googleapis.comstorage.googleapis.com, bigquery.googleapis.comstorage.googleapis.com, bigquery.googleapis.com
Resources in PerimeterNoneNoneNoneprojects/123456789projects/123456789projects/123456789projects/123456789, new-projectprojects/123456789, new-project
Access EnforcementOffOffOffOnOnOnOnOn
Audit Logs CheckedNoNoNoNoYesYesYesYes
Key Moments - 3 Insights
Why can't resources outside the perimeter access restricted services?
Because the perimeter enforces access restrictions at step 4, blocking access from outside resources as shown in the execution_table row 4.
Can you add more projects after creating the perimeter?
Yes, as shown in step 6, you can adjust the perimeter to include more projects or services.
What happens if you don't specify restricted services?
No services are restricted, so the perimeter won't block access; this is implied by the absence of restricted services in step 2.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution_table at step 3, what resource is added to the perimeter?
Astorage.googleapis.com
Bperimeter-1
Cprojects/123456789
Dbigquery.googleapis.com
💡 Hint
Check the 'Input/Command' and 'Result/State Change' columns at step 3 in the execution_table.
At which step does access enforcement become active?
AStep 2
BStep 4
CStep 5
DStep 6
💡 Hint
Look at the 'Access Enforcement' variable in variable_tracker and the 'Result/State Change' in execution_table.
If you add a new project at step 6, what changes in the variable_tracker?
AResources in Perimeter list updates
BPerimeter Name changes
CRestricted Services list changes
DAudit Logs Checked resets
💡 Hint
Check the 'Resources in Perimeter' row in variable_tracker after step 6.
Concept Snapshot
VPC Service Controls create a secure boundary called a perimeter.
You define which Google Cloud services are restricted inside it.
Add projects or resources to the perimeter to protect them.
Access outside the perimeter to restricted services is blocked.
Monitor access with audit logs and adjust perimeter as needed.
Full Transcript
VPC Service Controls help protect your cloud resources by creating a secure perimeter. You start by defining a perimeter and giving it a name. Then, you select which Google Cloud services should be restricted inside this perimeter, like Storage or BigQuery. Next, you add your projects or resources to this perimeter. Once set, the perimeter enforces access restrictions, blocking access to restricted services from outside resources. You can monitor access attempts using audit logs to see allowed or denied requests. If needed, you can adjust the perimeter by adding more projects or services. This process ensures your sensitive data stays protected within your defined boundary.

Practice

(1/5)
1. What is the main purpose of VPC Service Controls in Google Cloud?
easy
A. To manage user identities and access permissions
B. To create a secure boundary around cloud services to protect data
C. To automatically back up data to multiple regions
D. To increase the speed of network traffic between services

Solution

  1. Step 1: Understand the role of VPC Service Controls

    VPC Service Controls create a security perimeter around Google Cloud services to protect sensitive data from unauthorized access.
  2. Step 2: Compare with other options

    Options A, B, and C describe different Google Cloud features unrelated to VPC Service Controls.
  3. Final Answer:

    To create a secure boundary around cloud services to protect data -> Option B
  4. Quick Check:

    VPC Service Controls = Secure boundary [OK]
Hint: VPC Service Controls protect data by creating security boundaries [OK]
Common Mistakes:
  • Confusing VPC Service Controls with identity management
  • Thinking it speeds up network traffic
  • Assuming it handles backups automatically
2. Which of the following is the correct way to define a VPC Service Controls perimeter in a YAML configuration?
easy
A. perimeterType: 'NETWORK_PERIMETER' resources: - projects/project-123 restrictedServices: - storage.googleapis.com enforce: true
B. perimeterType: 'SERVICE_PERIMETER' resources: - projects/project-123 restrictedServices: - storage.googleapis.com allowAll: true
C. perimeterType: 'SERVICE_PERIMETER' resources: - projects/project-123 restrictedServices: - compute.googleapis.com enforce: false
D. perimeterType: 'SERVICE_PERIMETER' resources: - projects/project-123 restrictedServices: - storage.googleapis.com enforce: true

Solution

  1. Step 1: Identify correct perimeter type and enforcement

    VPC Service Controls use 'SERVICE_PERIMETER' as perimeterType and enforce true to activate restrictions.
  2. Step 2: Check restricted services and resource format

    Restricted services should list Google Cloud APIs like storage.googleapis.com, and resources should be project IDs.
  3. Final Answer:

    perimeterType: 'SERVICE_PERIMETER' with enforce: true and correct resources -> Option D
  4. Quick Check:

    Correct perimeterType and enforce true = perimeterType: 'SERVICE_PERIMETER' resources: - projects/project-123 restrictedServices: - storage.googleapis.com enforce: true [OK]
Hint: SERVICE_PERIMETER with enforce: true is required for VPC SC [OK]
Common Mistakes:
  • Using NETWORK_PERIMETER instead of SERVICE_PERIMETER
  • Setting enforce to false disables the perimeter
  • Using allowAll instead of enforce
3. Given this VPC Service Controls perimeter configuration:
perimeterType: 'SERVICE_PERIMETER'
resources:
  - projects/project-abc
restrictedServices:
  - storage.googleapis.com
  - bigquery.googleapis.com
enforce: true

What happens if a VM in project-abc tries to access compute.googleapis.com?
medium
A. Access is allowed only if the VM has special IAM roles
B. Access is denied because all services are blocked inside the perimeter
C. Access is allowed because compute.googleapis.com is not restricted
D. Access is denied because compute.googleapis.com is implicitly restricted

Solution

  1. Step 1: Understand restricted services in the perimeter

    The perimeter restricts only storage.googleapis.com and bigquery.googleapis.com.
  2. Step 2: Check access to compute.googleapis.com

    Since compute.googleapis.com is not listed, access is allowed by default.
  3. Final Answer:

    Access is allowed because compute.googleapis.com is not restricted -> Option C
  4. Quick Check:

    Only listed services are restricted = Access is allowed because compute.googleapis.com is not restricted [OK]
Hint: Only services listed in restrictedServices are blocked [OK]
Common Mistakes:
  • Assuming all services are blocked inside perimeter
  • Thinking IAM roles override perimeter restrictions
  • Believing unlisted services are implicitly blocked
4. You configured a VPC Service Controls perimeter but users report they cannot access Cloud Storage from inside the perimeter. Which of the following is the most likely cause?
medium
A. The perimeter's restrictedServices includes storage.googleapis.com and enforce is set to true
B. The perimeter is missing storage.googleapis.com in restrictedServices
C. The perimeter's enforce is set to false
D. The perimeter uses NETWORK_PERIMETER instead of SERVICE_PERIMETER

Solution

  1. Step 1: Analyze the effect of restrictedServices and enforce

    If storage.googleapis.com is in restrictedServices and enforce is true, access to Cloud Storage is blocked inside the perimeter.
  2. Step 2: Evaluate other options

    Missing storage.googleapis.com or enforce false would allow access; NETWORK_PERIMETER is invalid for VPC SC.
  3. Final Answer:

    restrictedServices includes storage.googleapis.com and enforce is true -> Option A
  4. Quick Check:

    Restricted service + enforce true blocks access [OK]
Hint: Restricted service with enforce true blocks access inside perimeter [OK]
Common Mistakes:
  • Thinking missing restrictedServices blocks access
  • Assuming enforce false blocks access
  • Confusing NETWORK_PERIMETER with SERVICE_PERIMETER
5. Your company wants to protect sensitive data in BigQuery and Cloud Storage using VPC Service Controls. You have two projects: project-secure and project-public. You want to allow project-public to access BigQuery but not Cloud Storage inside the perimeter. How should you configure the perimeter?
hard
A. Include both projects in resources, restrict only storage.googleapis.com
B. Include only project-secure in resources, restrict both storage.googleapis.com and bigquery.googleapis.com
C. Include both projects in resources, restrict both storage.googleapis.com and bigquery.googleapis.com
D. Include only project-public in resources, restrict storage.googleapis.com

Solution

  1. Step 1: Determine which projects to include in the perimeter

    To protect data in both projects but allow project-public access to BigQuery, include both projects in the perimeter.
  2. Step 2: Set restricted services to block only Cloud Storage

    Restrict storage.googleapis.com to block Cloud Storage access, but do not restrict bigquery.googleapis.com to allow BigQuery access from project-public.
  3. Final Answer:

    Include both projects and restrict only storage.googleapis.com -> Option A
  4. Quick Check:

    Both projects + restrict storage only = Include both projects in resources, restrict only storage.googleapis.com [OK]
Hint: Restrict only storage to block Cloud Storage, include both projects [OK]
Common Mistakes:
  • Restricting both services blocks BigQuery access
  • Including only one project limits protection
  • Restricting BigQuery when access is needed
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard