Study guide

11.1 Connecting to and Managing Running Compute Engine Instances

Google Cloud Associate Cloud Engineer ACE

Track your progress as you read

Finished sections get a check mark.

1 Chapter 1: Introduction & Exam Overview

1.1 About the GCP Associate Cloud Engineer Exam 1.2 How to Use This Study Guide & Build a Study Plan

2 Chapter 2: Resource Hierarchy, IAM Basics & Cloud Identity

2.1 The GCP Resource Hierarchy: Organizations, Folders & Projects 2.2 Organization Policies & Granting IAM Roles 2.3 Cloud Identity: Managing Users and Groups

3 Chapter 3: APIs, Quotas & Billing Configuration

3.1 Enabling APIs and Provisioning Cloud Operations Suite 3.2 Assessing and Requesting Quota Increases 3.3 Billing Accounts, Project Linking & Billing Exports 3.4 Billing Budgets and Alerts

4 Chapter 4: Planning Compute & Storage Resources

4.1 Choosing the Right Compute Option: GCE vs. GKE vs. Cloud Run vs. Cloud Functions 4.2 Spot VMs, Custom Machine Types & Cost-Optimized Compute Planning 4.3 Choosing a Data Storage Product: Cloud SQL, BigQuery, Firestore, Spanner & Bigtable 4.4 Cloud Storage Classes & Persistent Disk Types

5 Chapter 5: Planning Network Resources

5.1 Load Balancing Options and Use Cases 5.2 Regional Resource Placement & High Availability Planning 5.3 Network Service Tiers: Premium vs. Standard

6 Chapter 6: Deploying Compute Engine Workloads

6.1 Launching Compute Engine Instances: Disks, SSH Keys & Availability Policies 6.2 Managed Instance Groups, Instance Templates & Autoscaling 6.3 OS Login and VM Manager for Fleet Configuration

7 Chapter 7: Deploying Google Kubernetes Engine Workloads

7.1 Installing and Configuring kubectl 7.2 Deploying GKE Clusters: Autopilot, Regional, Private & GKE Enterprise 7.3 Deploying Containerized Applications to GKE

8 Chapter 8: Deploying Serverless & Event-Driven Applications

8.1 Deploying Applications to Cloud Run and Cloud Functions 8.2 Event-Driven Architectures: Pub/Sub, Cloud Storage Triggers & Eventarc

9 Chapter 9: Deploying Data Solutions

9.1 Deploying Data Products: Cloud SQL, Firestore, Spanner, BigQuery & AlloyDB 9.2 Deploying Pub/Sub, Dataflow & Loading Data into Google Cloud

10 Chapter 10: Deploying Networking Resources & Infrastructure as Code

10.1 Creating VPCs, Subnets & Shared VPC 10.2 Firewall Rules, Cloud VPN & VPC Network Peering 10.3 Infrastructure as Code: Terraform, Config Connector, Cloud Foundation Toolkit & Helm

11 Chapter 11: Managing Compute Engine & GKE in Production

11.1 Connecting to and Managing Running Compute Engine Instances 11.2 Working with Snapshots and Custom Images 11.3 Managing GKE Clusters: Node Pools, Workloads & Artifact Registry Access 11.4 Horizontal and Vertical Pod Autoscaling in GKE

12 Chapter 12: Managing Cloud Run, Storage & Database Operations

12.1 Managing Cloud Run Revisions, Traffic Splitting & Scaling 12.2 Managing and Securing Cloud Storage Objects & Lifecycle Policies 12.3 Querying, Estimating Costs, Backup & Job Monitoring for Databases (Cloud SQL, BigQuery, Spanner, Dataflow)

13 Chapter 13: Networking Operations, Monitoring & Logging

13.1 Networking Operations: Subnets, Static IPs, Cloud DNS & Cloud NAT 13.2 Cloud Monitoring: Alerts, Custom Metrics & Dashboards 13.3 Cloud Logging: Buckets, Log Analytics, Routers & Filtering 13.4 Diagnostics, Ops Agent, Managed Service for Prometheus & Audit Logs

14 Chapter 14: IAM Policies & Role Types

14.1 IAM Policies: Structure, Bindings & Policy Hierarchy 14.2 IAM Role Types: Basic, Predefined & Custom Roles

15 Chapter 15: Service Accounts & Security Configuration

15.1 Creating Service Accounts & Assigning Least-Privilege Permissions 15.2 Assigning Service Accounts to Resources & Managing SA IAM Policies 15.3 Service Account Impersonation & Short-Lived Credentials

16 Chapter 16: Exam Readiness — Scenarios & Test-Day Strategy

16.1 Common ACE Exam Scenarios & Decision Frameworks 16.2 Test-Day Logistics, Time Management & Final Review Checklist

11.1 Connecting to and Managing Running Compute Engine Instances

Key Takeaways Explain This Topic AI

The Identity-Aware Proxy (IAP) TCP forwarding range is a fixed CIDR block, 35.235.240.0/20 — firewall rules for SSH/RDP over IAP must allow ingress from exactly that range.

OS Login ties SSH access to IAM identities (auditable, centrally revocable); metadata-based SSH keys are managed per-project or per-instance with no IAM tie-in.

A project-wide SSH key set in project metadata applies to every VM in the project unless an individual instance has "Block project-wide SSH keys" enabled.

gcloud compute instances list/describe/start/stop/reset/suspend is the exam's core lifecycle command set; add-metadata attaches custom key-value configuration data to a running or stopped VM.

Whoever connects to a VM inherits the IAM permissions of that VM's attached service account — SSH access is effectively an extension of the instance's identity, not just the user's.

Last updated: July 2026

Why This Topic Matters

Domain 4 of the Associate Cloud Engineer (ACE) exam guide, "Ensuring successful operation of a cloud solution," opens with two bullets that sound simple but hide a lot of exam traps: remotely connecting to the instance and viewing current running VM inventory . In practice this means ACE will hand you a scenario — "a VM has no external IP," "a security team wants centrally revocable SSH access," "a script needs to enumerate every running VM in a project" — and ask you to pick the right gcloud command or connection mechanism. Getting the mechanics of Identity-Aware Proxy (IAP) , OS Login , and instance metadata right is a recurring theme across several exam domains, not just this one, because the same SSH-key and IAM concepts resurface in the security domain (Chapter 15).

Ways to Connect to a Running Instance

Google Cloud supports four practical connection paths to a Linux Compute Engine VM:

SSH-in-browser — a button in the Cloud Console that opens a terminal directly in the browser. It generates ephemeral SSH keys automatically, so there is nothing to manage, but it requires the instance to have connectivity the console can reach (an external IP, or IAP if none).

gcloud compute ssh — the command-line equivalent: gcloud compute ssh INSTANCE_NAME --zone=ZONE --project=PROJECT_ID . The first time you run this against a project, gcloud generates a persistent SSH key pair and pushes the public key to instance or project metadata for you.

Native OpenSSH / PuTTY / Secure Shell extension — you add your own public key to instance or project metadata, then connect directly with ssh -i PATH_TO_KEY USERNAME@EXTERNAL_IP . This is the path enterprises use when they want to bring their own key management.

IAP TCP forwarding — the only supported method when a VM has no external IP address and you do not want to stand up a bastion host or VPN. IAP proxies the TCP connection through Google's infrastructure.

OS Login vs. Metadata-Based SSH Keys

This is one of the most heavily tested distinctions in this section:

Aspect Metadata-based SSH keys OS Login

Identity source Public key stored in instance/project metadata Google/IAM identity (Cloud Identity or Google Workspace account)

Auditability Hard to trace which human used a shared key Every login is tied to an IAM principal — fully auditable

Revocation Must delete the key from metadata manually, VM by VM Revoke the IAM role and access is gone everywhere immediately

Scope Project-wide key applies to every VM in the project unless overridden Enabled per-project or per-instance via the enable-oslogin metadata key

Enterprise recommendation Legacy / simple use cases Recommended for production and regulated environments

A classic exam trap: a team sets an SSH key in project metadata , expecting it to reach only one VM. In fact, project-level metadata SSH keys propagate to every instance in the project unless that specific instance has the --metadata block-project-ssh-keys=TRUE flag (or the equivalent console checkbox "Block project-wide SSH keys") set.

IAP TCP Forwarding: The No-External-IP Path

When a VM has only an internal IP (the recommended posture for production workloads), IAP TCP forwarding is the standard ACE-tested answer for how an engineer still reaches it for troubleshooting. Two things must be true:

A firewall rule must allow ingress from IAP's fixed source range: gcloud compute firewall-rules create allow-ssh-ingress-from-iap \

  • -direction=INGRESS --action=allow --rules=tcp:22 \
  • -source-ranges=35.235.240.0/20

35.235.240.0/20 is a Google-owned, fixed CIDR block used exclusively for IAP TCP forwarding traffic — memorize this range, it appears verbatim in exam scenarios. Add tcp:3389 to the same rule for Windows RDP.

2. The connecting principal needs both roles/iap.tunnelResourceAccessor (to use the tunnel) and a compute role such as roles/compute.instanceAdmin.v1 or roles/compute.osLogin (to reach the instance itself).

  • The actual tunnel is opened with: gcloud compute start-iap-tunnel INSTANCE_NAME 3389 \
  • -local-host-port=localhost:LOCAL_PORT --zone=ZONE

or, more commonly for SSH, simply gcloud compute ssh INSTANCE_NAME --tunnel-through-iap .

Managing Running Instances: The Lifecycle Command Set

Beyond connecting, ACE tests the everyday operational commands for a fleet of VMs:

  • Task Command
  • View all running/stopped VMs in a project gcloud compute instances list
  • Inspect a single instance's full configuration gcloud compute instances describe INSTANCE_NAME
  • Start a stopped instance gcloud compute instances start INSTANCE_NAME
  • Gracefully stop a running instance gcloud compute instances stop INSTANCE_NAME
  • Hard reset (like pulling the power cord, no clean shutdown) gcloud compute instances reset INSTANCE_NAME
  • Attach custom key-value configuration gcloud compute instances add-metadata INSTANCE_NAME --metadata KEY=VALUE

instances reset is a common distractor on the exam: candidates confuse it with stop . Reset performs a hard reboot without a graceful OS shutdown — correct for a hung VM, wrong for routine maintenance where stop (or suspend , which preserves in-memory state to persistent disk for a faster resume) is the safer choice.

Realistic Exam Scenario

A finance team's VMs sit in a private subnet with no external IPs for compliance reasons, but the platform team occasionally needs to SSH in for troubleshooting, and security requires that every login be traceable to a named engineer. The ACE-correct architecture is: enable OS Login on the project ( gcloud compute project-info add-metadata --metadata enable-oslogin=TRUE ), grant engineers roles/compute.osLogin plus roles/iap.tunnelResourceAccessor , and create a firewall rule allowing tcp:22 from 35.235.240.0/20 only. No bastion host, no VPN, no external IPs — and every session is tied to an IAM identity.