GCP Core Infrastructure (IAM, Compute Engine, GKE, Cloud Run & VPC)

Google Cloud Associate Cloud Engineer (ACE) and Professional Cloud Architect core infrastructure mastery covering the GCP Resource Hierarchy, IAM Roles, Service Accounts, Workload Identity Federation, Compute Engine, GKE (Standard vs Autopilot), Cloud Run, App Engine, and Global VPC Networking.

Level
intermediate
Languages
en → en
Cards
32
Markdown
GCP Core Infrastructure (IAM, Compute Engine, GKE, Cloud Run & VPC) (.md)

Flashcards (32)

#Front (Term / Question)Back (Definition / Answer)ExampleMultiple-Choice Options
1What are the `gcloud` CLI commands to manage configurations, set project/region defaults, and inspect active credentials?`gcloud config configurations create/activate <NAME>` manages named environment profiles; `gcloud config set project <PROJECT_ID>` and `gcloud config set compute/region <REGION>` set active defaults; `gcloud auth list` lists authenticated accounts (`ACTIVE` marked with `*`); `gcloud auth application-default login` sets up ADC credentials for local SDK libraries; `gcloud info` displays environment details and log file paths.
2Compare Cloud Run, Cloud Run Functions (formerly Cloud Functions 2nd Gen), and App Engine Standard/Flexible.Cloud Run: Serverless platform for any stateless HTTP/gRPC container (or Cloud Run Jobs for batch), supports up to 1,000 concurrent requests per container instance, scales to zero (or min instances), up to 60-minute request timeout. Cloud Run Functions: Event-driven single-purpose functions written in source code (built on Cloud Run + Eventarc). App Engine Standard (language sandboxes, scales to zero quickly) vs App Engine Flexible (Docker containers on GCE VMs, cannot scale to zero).
3Compare Sustained Use Discounts (SUDs) and Committed Use Discounts (CUDs) in Google Compute Engine.Sustained Use Discounts (SUDs): Automatic incremental discounts (up to 20–30%) applied when eligible VM families (`N1`, `N2`, `N2D`) run for more than 25% of a billing month—no upfront commitment required (Note: `E2` does not get SUDs). Committed Use Discounts (CUDs): 1-year or 3-year commitments (up to 55–70% discount) available as Resource-based CUDs (specific region/project/vCPU/RAM) or Flexible Spend-based CUDs ($/hr across regions/services).
4What are Private Google Access and Cloud NAT, and how do they work together for VMs without external IP addresses?Private Google Access (enabled per subnet) allows VMs with ONLY internal private IPs to reach Google APIs and services (like Cloud Storage or BigQuery) over Google's internal network without traversing the public internet. Cloud NAT is a software-defined, regional, managed Network Address Translation service (requiring a Cloud Router for control plane only) that allows private VMs/GKE nodes to initiate outbound connections to the external internet for OS package updates without allowing unsolicited inbound internet connections.
5How does Google Cloud VPC architecture differ fundamentally from AWS and Azure VPC/VNet regarding regional vs. global scope?In Google Cloud, a VPC Network is a GLOBAL resource (spanning all GCP regions worldwide without needing cross-region peering), while Subnets (`Subnetworks`) are REGIONAL resources (each subnet spans all Availability Zones within a single GCP region). Therefore, VMs in `us-central1` and `europe-west1` subnets within the same VPC can communicate directly over private RFC 1918 IPs using Google's global Andromeda software-defined network.
6What is GKE Workload Identity and how does it bind Kubernetes Pods to GCP IAM?Workload Identity is the recommended way for Pods in Google Kubernetes Engine (GKE) to authenticate to GCP APIs without node-level over-privileged service accounts or JSON keys. You annotate a Kubernetes ServiceAccount (`iam.gke.io/gcp-service-account`) and bind the GCP Service Account with `roles/iam.workloadIdentityUser` to the K8s identity `serviceAccount:<PROJECT_ID>.svc.id.goog[<NAMESPACE>/<KSA_NAME>]`. The GKE metadata server intercepts Pod token requests.
7Compare Premium Tier vs. Standard Tier in Google Cloud Network Service Tiers.Premium Tier (default): Delivers traffic over Google's low-latency, highly reliable global private fiber backbone, entering/exiting at the Google Edge POP closest to the end user (supports Global Load Balancing with a single Anycast IP). Standard Tier: Delivers traffic over the public ISP transit network, entering/exiting Google's network at the region where the resource resides (lower cost, regional Load Balancing IPs only).
8Can you expand or shrink an existing Subnet's primary CIDR range in a Google Cloud VPC?You CAN expand a subnet's primary IPv4 CIDR range in-place (by decreasing the prefix length, e.g., `/24` to `/20`) with zero downtime or VM recreation, provided the expanded block does not overlap with other subnets. However, you CANNOT shrink (increase the prefix length of) an existing primary CIDR range once created.
9What is OS Login in Google Compute Engine and why is it preferred over project/instance metadata SSH keys?By setting metadata `enable-oslogin=TRUE`, OS Login links Linux user accounts and SSH public keys directly to a user's Google Cloud Identity/IAM profile rather than scattering static SSH keys across project metadata. Access is controlled via IAM roles (`roles/compute.osLogin` for non-root SSH, `roles/compute.osAdminLogin` for `sudo` access) and automatically revoked when a user leaves the organization, supporting 2FA (`enable-oslogin-2fa=TRUE`).
10What are the three identifiers of a Google Cloud Project, and which ones are mutable vs. immutable?1. Project Name: Human-readable display label chosen by you; mutable (can be changed anytime) and does NOT need to be unique. 2. Project ID: Globally unique string chosen by you at creation (used in CLI commands and resource URIs); IMMUTABLE after creation. 3. Project Number: Globally unique integer automatically generated by Google Cloud; IMMUTABLE.
11What is VPC Service Controls (VPC-SC) in Google Cloud and what threat does it mitigate?VPC Service Controls creates a context-aware security perimeter around Google Cloud multi-tenant managed APIs (such as Cloud Storage, BigQuery, and Pub/Sub) to prevent data exfiltration. Even if an attacker steals valid IAM credentials or a public bucket policy is misconfigured, VPC-SC blocks data from being copied outside the authorized service perimeter or accessed from unauthorized networks/identities.
12Compare GCP Spot VMs (formerly Preemptible VMs) with Standard VMs on Compute Engine.Spot VMs offer 60–91% discounts off on-demand prices by utilizing spare Compute Engine capacity. Unlike legacy Preemptible VMs (which had a hard 24-hour maximum runtime limit), Spot VMs have NO maximum runtime limit, but Compute Engine can preempt (stop or delete) them at any time with a 30-second ACPI shutdown notice (`preemption notice`) if capacity is needed.
13Compare Shared VPC and VPC Network Peering in Google Cloud.Shared VPC (centralized governance within ONE Organization): A designated Host Project owns the VPC and subnets, while Service Projects attach their VMs/GKE clusters into those shared subnets using IAM (`compute.networkUser`). VPC Network Peering (decentralized, works across same or DIFFERENT Organizations): Connects two independent VPC networks over RFC 1918 private IPs; non-transitive, limit of 25 peerings per VPC, each project admin manages their own firewall rules.
14Compare the three ways to specify targets/sources in Google Cloud VPC Firewall Rules: All instances, Network Tags, and Service Accounts.1. All instances in the network: Applies broadly to every VM in the VPC. 2. Target Network Tags: Arbitrary strings attached to VMs; any user with VM edit permissions (`compute.instances.setTags`) can add/remove tags, making it less secure against privilege escalation. 3. Target Service Accounts (recommended): Cryptographically tied to the VM's attached IAM Service Account (`roles/iam.serviceAccountUser` required to attach, and VM must be stopped to change its Service Account).
15Compare Zonal, Multi-Zonal, and Regional GKE clusters.Zonal cluster: Single control plane in one zone with worker nodes in that same zone (if the zone goes down, both control plane and workloads fail). Multi-Zonal cluster: Single control plane in one zone, with worker nodes distributed across multiple zones (workloads survive a zone outage, but the K8s API is unavailable during control plane zone failure). Regional cluster (recommended for prod): Replicates BOTH the control plane (across 3 zones) and worker nodes across multiple zones.
16Compare Google Compute Engine (GCE) machine families: E2/N2/N2D/N4 (General Purpose), C2/C3/C4 (Compute Optimized), M1/M2/M3 (Memory Optimized), and A2/A3/G2 (Accelerator Optimized).General Purpose: `E2` (cost-optimized dynamic underlying CPU, shared-core options), `N2`/`N2D`/`N4`/`C3` (balanced price/performance, sustained use or CUDs). Compute Optimized (`C2`/`C2D`/`C3`/`H3`): High single-thread clock speeds for HPC, gaming, and CPU-bound tasks. Memory Optimized (`M1`/`M2`/`M3`): Multi-terabyte RAM (up to 32 TB) for SAP HANA and in-memory databases. Accelerator Optimized (`A2`/`A3`/`G2`): Attached NVIDIA A100/H100/L4 GPUs for ML training and inference.
17What are the four reserved IP addresses in every Google Cloud VPC Subnet?Google Cloud reserves 4 IP addresses in every primary subnet range: 1. Network address (first IP, e.g., `.0`); 2. Default gateway router (second IP, e.g., `.1`); 3. Second-to-last IP (reserved for future use, e.g., `.254`); 4. Broadcast address (last IP, e.g., `.255`). Thus, usable IPs per GCP subnet = $2^{(32 - \text{prefix})} - 4$ (one more usable IP than AWS/Azure).
18What are Google Cloud Armor and Identity-Aware Proxy (IAP), and how do they secure applications?Cloud Armor sits at the edge of External Load Balancers to provide DDoS mitigation, preconfigured OWASP Top 10 WAF rules (SQLi/XSS), geo-blocking, rate limiting, and Adaptive Protection. Identity-Aware Proxy (IAP) implements Google's BeyondCorp Zero Trust model by verifying user identity and context before forwarding HTTPS or TCP/SSH/RDP traffic (from `35.235.240.0/20`) to VMs or web apps without needing a corporate VPN.
19What are the requirements to achieve a 99.99% SLA vs. a 99.9% SLA on Google Cloud Interconnect?99.99% SLA (Production critical): Requires at least FOUR redundant VLAN attachments across TWO different Metropolitan Areas (Edge Availability Domains, e.g., metro 1 zone 1 + zone 2 AND metro 2 zone 1 + zone 2) connected to two global VPC Cloud Routers. 99.9% SLA (Non-critical): Requires two redundant VLAN attachments in two different zones within a SINGLE Metropolitan Area.
20What are the four levels of the Google Cloud Resource Hierarchy from top to bottom, and how do IAM and Organization Policies inherit?Organization Node (root tied to Google Workspace or Cloud Identity domain) -> Folders (optional, nestable up to 10 levels for departments/teams/environments) -> Projects (trust boundary for billing, APIs, and resources) -> Resources. IAM policies are strictly additive down the hierarchy (child cannot revoke permissions granted at a parent level unless a Deny Policy is used), and Organization Policy constraints are inherited by all descendants.
21What are Compute Engine Managed Instance Groups (MIGs), and how do Stateless vs. Stateful MIGs differ?A Managed Instance Group (MIG) uses an Instance Template to manage a fleet of VMs as a single entity, providing autohealing (via health checks), autoscaling (by CPU, Load Balancer capacity, Cloud Monitoring metric, or schedule), rolling updates/canary deployments, and multi-zone distribution. Stateless MIGs treat VMs as disposable; Stateful MIGs preserve each instance's unique name, attached Persistent Disks, and internal/external IP addresses across recreations and autohealing.
22What are the two implied firewall rules that exist in every Google Cloud VPC, and how do Hierarchical Firewall Policies work?Every VPC has two implied lowest-priority (`65535`) rules that cannot be deleted (only overridden by higher-priority rules `0–65534`): 1. Implied Allow Egress (`0.0.0.0/0`, all protocols/ports); 2. Implied Deny Ingress (`0.0.0.0/0`, all protocols/ports). Hierarchical Firewall Policies are applied at the Organization or Folder level and support a `goto_next` (delegate) action so security teams can enforce mandatory enterprise allow/deny rules before project-level VPC rules are evaluated.
23Compare Auto Mode VPC networks and Custom Mode VPC networks in GCP.Auto Mode VPC (like the `default` network): Automatically creates one `/20` subnet in every GCP region from the predefined `10.128.0.0/9` CIDR block; complicates VPN/peering due to overlapping IP ranges. Custom Mode VPC (recommended for production): Creates no subnets automatically; you explicitly define which regions get subnets and specify exact CIDR ranges. You can convert an Auto Mode VPC to Custom Mode (one-way conversion), but not vice versa.
24Compare the three types of IAM Roles in Google Cloud: Basic (Primitive), Predefined, and Custom Roles.Basic Roles (`Owner`, `Editor`, `Viewer`, `Billing Administrator`): Coarse-grained legacy roles applied at the Project/Folder/Org level containing thousands of permissions across all services (violates least privilege in production). Predefined Roles (e.g., `roles/storage.objectViewer`, `roles/compute.instanceAdmin.v1`): Fine-grained, service-specific roles maintained and updated by Google. Custom Roles: User-created collections of specific `service.resource.verb` permissions maintained by the customer at the Project or Organization level.
25Compare Google Cloud Interconnect options (Dedicated Interconnect vs. Partner Interconnect) and HA VPN.Dedicated Interconnect: Direct physical fiber connection at a colocation facility between your router and Google's network; 10 Gbps or 100 Gbps links (up to 8x10G or 2x100G). Partner Interconnect: Connects via a supported network service provider; capacities from 50 Mbps to 50 Gbps. HA VPN: Managed IPsec VPN over the public internet using two active/active interfaces with dynamic BGP routing via Cloud Router (provides 99.99% SLA when two tunnels are configured).
26How do Startup Scripts and the Instance Metadata Server (`169.254.169.254`) work in Google Compute Engine?Every GCE VM can query `http://metadata.google.internal/computeMetadata/v1/` (IP `169.254.169.254`) with the required header `Metadata-Flavor: Google` to retrieve project/instance attributes, SSH keys, and service account OAuth tokens. A startup script is passed via the metadata key `startup-script` (or `startup-script-url` pointing to a GCS bucket; `windows-startup-script-ps1` for Windows) and runs as root on every boot.
27Why are User-Managed Service Account Keys (JSON files) considered a high security risk in GCP, and what are the recommended alternatives?Downloadable JSON private keys do not expire automatically by default, can be leaked in Git repositories, and are hard to audit/rotate. Recommended alternatives: 1. Attached Service Accounts / Workload Identity for workloads running inside GCP; 2. Service Account Impersonation (`--impersonate-service-account`, short-lived OAuth tokens) for local developer testing; 3. Workload Identity Federation for external workloads (AWS, Azure, GitHub Actions, on-prem K8s).
28How does Google Cloud Workload Identity Federation allow workloads on AWS, Azure, or GitHub Actions to access GCP without JSON keys?You create a Workload Identity Pool and Provider configured to trust an external OIDC (e.g., GitHub Actions, Azure Entra ID, Kubernetes) or AWS STS identity provider. The external workload exchanges its native platform credential with the Google Security Token Service (STS) for a federated token, which then impersonates a GCP Service Account to obtain short-lived GCP access tokens.
29How does Google Cloud Router work with BGP and what is the difference between Regional and Global Dynamic Routing mode in a VPC?Cloud Router exchanges routes dynamically between your VPC and on-premises networks using BGP (Border Gateway Protocol) over Cloud VPN or Cloud Interconnect; it sits exclusively in the control plane (actual data packets do not pass through it). In Regional dynamic routing mode, a Cloud Router only advertises subnets and learns routes within its own region; in Global dynamic routing mode, it advertises and propagates routes across all regions in the VPC.
30Why can a Google Cloud Service Account act as both an 'Identity' and a 'Resource' in IAM?As an Identity (Principal), a Service Account is granted roles on other GCP resources (e.g., `roles/storage.objectViewer` on a bucket) so a VM or container can call GCP APIs. As a Resource, an IAM policy can be attached directly TO the Service Account itself, granting specific users or other service accounts the `roles/iam.serviceAccountUser` or `roles/iam.serviceAccountTokenCreator` role to attach or impersonate ONLY that Service Account.
31Compare Google Kubernetes Engine (GKE) Standard mode vs. Autopilot mode.GKE Standard: You configure and manage the underlying Node Pools (machine types, node autoscaling, max pods per node) and pay per provisioned Compute Engine node VM regardless of pod utilization. GKE Autopilot: Google manages the nodes, security hardening (Shielded GKE nodes, Workload Identity enabled by default, no SSH to nodes), and scaling; you pay strictly for the vCPU, memory, and ephemeral storage requested by your running Pods.
32How do you Choose the Right Google Cloud Load Balancer across Global vs. Regional, External vs. Internal, and Layer 7 vs. Layer 4?Global External Application LB (HTTP/HTTPS): Anycast IP across global edge POPs with URL Maps, Cloud CDN, and Cloud Armor. Global External Proxy Network LB: TCP/SSL proxy for non-HTTP global traffic. Regional External/Internal Application LB: Envoy-based L7 HTTP/HTTPS within one region. External/Internal Passthrough Network LB: Andromeda-based L4 TCP/UDP load balancer that preserves client source IP without proxying.