Bird
Raised Fist0
GCPcloud~20 mins

VPC Service Controls in GCP - Practice Problems & Coding Challenges

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
VPC Service Controls Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Understanding VPC Service Controls Perimeter Behavior

You have created a VPC Service Controls perimeter around your Google Cloud project to protect sensitive data. Which of the following statements best describes what happens when a request originates from outside the perimeter trying to access a protected service inside?

AThe request is blocked unless it originates from a resource inside the perimeter or from an authorized access level.
BThe request is always allowed but logged for auditing purposes.
CThe request is allowed if it uses a service account with the correct IAM role, regardless of origin.
DThe request is allowed only if it comes from a trusted IP address range configured in the perimeter.
Attempts:
2 left
💡 Hint

Think about how VPC Service Controls restrict access based on network boundaries and access levels.

❓ Architecture
intermediate
2:00remaining
Designing a VPC Service Controls Perimeter for Multi-Project Access

You have two Google Cloud projects: Project A and Project B. Both need to access a shared Cloud Storage bucket protected by a VPC Service Controls perimeter. How should you configure the perimeter to allow access from both projects?

ACreate a single perimeter that includes both Project A and Project B as protected resources.
BDo not use perimeters; rely solely on IAM permissions for access control.
CCreate a perimeter only around Project A and grant IAM roles to Project B's service accounts.
DCreate separate perimeters for each project and link them with a service perimeter bridge.
Attempts:
2 left
💡 Hint

Consider how VPC Service Controls handle multiple projects needing shared access.

❓ security
advanced
2:00remaining
Evaluating Access Levels in VPC Service Controls

You configured an access level using Access Context Manager to allow access only from devices with a specific security posture. Which of the following is a valid way to enforce this access level in your VPC Service Controls perimeter?

AUse the access level only in IAM policies for service accounts accessing resources.
BAttach the access level to the perimeter's ingress rules to restrict incoming requests.
CApply the access level as an egress rule to control outbound traffic from the perimeter.
DConfigure the access level as a firewall rule in the VPC network.
Attempts:
2 left
💡 Hint

Think about how access levels integrate with VPC Service Controls to restrict access.

❓ service_behavior
advanced
2:00remaining
Impact of VPC Service Controls on Cloud Functions Invocations

You have deployed Cloud Functions inside a VPC Service Controls perimeter. What happens when an external client tries to invoke a Cloud Function protected by the perimeter without proper access level?

AThe invocation is queued until the client gains proper access level.
BThe Cloud Function executes but logs a warning about perimeter violation.
CThe invocation request is blocked and returns a 403 Forbidden error.
DThe Cloud Function executes normally because VPC Service Controls do not affect Cloud Functions.
Attempts:
2 left
💡 Hint

Consider how VPC Service Controls enforce perimeter boundaries on service invocations.

✅ Best Practice
expert
3:00remaining
Optimizing VPC Service Controls Perimeter for Least Privilege Access

You want to enforce least privilege access using VPC Service Controls for a sensitive BigQuery dataset. Which configuration best achieves this goal?

ACreate a perimeter including only the BigQuery service and restrict access with access levels based on user identity and device security.
BCreate a perimeter including all Google Cloud services and allow access from all internal IP ranges.
CUse IAM roles only without creating a perimeter to simplify management.
DCreate a perimeter including BigQuery and Cloud Storage, allowing access from any Google-managed service account.
Attempts:
2 left
💡 Hint

Think about how to limit access to only what is necessary and secure.

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