Compute Engine Interview Questions (Top 15 Questions with Answers)
Master Google Cloud Compute Engine Interview Questions with production-ready explanations covering virtual machines, machine families, persistent disks, images, snapshots, Managed Instance Groups, autoscaling, Spot VMs, load balancing, startup scripts, and production best practices.
Module Navigation
Previous: GCP Fundamentals QA | Parent: GCP Learning Path | Next: Cloud Storage QA
Introduction
Google Compute Engine (GCE) is Google Cloud's Infrastructure as a Service (IaaS) offering that allows users to create and manage Virtual Machines (VMs).
It provides complete control over:
- Operating System
- CPU
- Memory
- Storage
- Networking
- Security
- Machine Types
- Startup Scripts
- GPUs
- Load Balancing
Compute Engine is widely used for:
- Enterprise applications
- Java Spring Boot services
- Databases
- Kubernetes worker nodes
- Batch processing
- Machine Learning
- Legacy application migration
Users
│
▼
Load Balancer
│
▼
Compute Engine VMs
│
┌──────┼──────┐
▼ ▼ ▼
Disk Network IAM
This guide contains 15 production-focused Compute Engine interview questions covering VM architecture, machine types, storage, networking, scaling, security, and production best practices.
Learning Roadmap
Virtual Machines
│
▼
Machine Types
│
▼
Persistent Disk
│
▼
Images & Snapshots
│
▼
Managed Instance Groups
│
▼
Autoscaling
│
▼
Spot VMs
│
▼
Production Architecture
Compute Engine Fundamentals
1. What is Google Compute Engine?
Compute Engine is Google Cloud's Infrastructure as a Service (IaaS) solution that provides highly configurable Virtual Machines.
Features include:
- Linux and Windows VMs
- Custom machine types
- SSD and HDD disks
- GPUs
- Startup scripts
- Snapshots
- Load balancing
- Autoscaling
- Managed Instance Groups
- Live migration
Benefits:
- Full OS control
- Elastic scaling
- Enterprise security
- Global deployment
- Pay-as-you-go pricing
2. What are Machine Types in Compute Engine?
A machine type defines the compute resources assigned to a VM.
It specifies:
- vCPUs
- Memory
- Processor generation
Common machine families:
| Family | Best For |
|---|---|
| E2 | Cost-optimized workloads |
| N2 | General-purpose applications |
| C2 | Compute-intensive workloads |
| M2/M3 | Memory-intensive databases |
| T2D | Scale-out workloads |
| A2 | GPU and AI workloads |
Choosing the correct machine family improves both performance and cost.
3. What is the difference between predefined and custom machine types?
Predefined Machine
Google provides fixed combinations of CPU and memory.
Example:
4 vCPU
16 GB RAM
Custom Machine
Users select their own CPU and memory combination.
Example:
6 vCPU
22 GB RAM
Advantages of custom machines:
- Better resource utilization
- Reduced cost
- Eliminate overprovisioning
Storage
4. What is a Persistent Disk?
Persistent Disk is block storage attached to Compute Engine VMs.
Characteristics:
- Independent of VM lifecycle
- Durable
- High performance
- Can survive VM deletion (if configured)
- Supports snapshots
Types:
- Standard HDD
- Balanced Persistent Disk
- SSD Persistent Disk
- Extreme Persistent Disk
Persistent Disks are commonly used for:
- Operating systems
- Databases
- Enterprise applications
5. What is the difference between Persistent Disk and Local SSD?
| Persistent Disk | Local SSD |
|---|---|
| Durable | Temporary |
| Survives VM restart | Lost when VM stops or is deleted |
| Good for databases | Good for caching |
| Lower latency than HDD | Extremely low latency |
| Supports snapshots | No snapshots |
Use Local SSD only when applications can tolerate data loss.
6. What are Images and Snapshots?
Image
An image is a reusable VM template.
It contains:
- Operating system
- Installed software
- Configuration
Used for creating multiple identical VMs.
Snapshot
A snapshot is a point-in-time backup of a Persistent Disk.
Benefits:
- Backup
- Disaster recovery
- Restore
- Migration
Example:
Persistent Disk
│
▼
Snapshot
│
▼
Restore
Scaling
7. What is a Managed Instance Group (MIG)?
A Managed Instance Group is a collection of identical VM instances managed automatically.
Features:
- Auto healing
- Autoscaling
- Rolling updates
- Load balancing
- High availability
Example:
Managed Instance Group
VM1
VM2
VM3
VM4
If one VM fails, Google automatically creates another.
8. How does autoscaling work in Compute Engine?
Autoscaling automatically adjusts the number of VM instances based on workload.
Scaling metrics include:
- CPU utilization
- Load balancing requests
- Cloud Monitoring metrics
- Custom metrics
- Scheduled scaling
Example:
Low Traffic
2 VMs
↓
High Traffic
10 VMs
Autoscaling reduces both costs and operational effort.
9. What is auto healing?
Auto healing automatically recreates unhealthy VM instances.
Workflow:
Health Check
↓
VM Healthy?
↓
Yes → Continue
No
↓
Terminate VM
↓
Create New VM
Auto healing improves application availability.
Cost Optimization
10. What are Spot VMs?
Spot VMs are discounted virtual machines that Google can terminate at any time.
Benefits:
- Significant cost savings
- Suitable for batch processing
- Ideal for CI/CD
- Good for analytics
- Useful for machine learning training
Not suitable for:
- Critical databases
- Stateful applications
- Authentication services
Applications should be interruption tolerant.
11. How can Compute Engine costs be optimized?
Best practices:
- Right-size VMs
- Use autoscaling
- Use Spot VMs
- Schedule development environments
- Delete unused disks
- Remove idle instances
- Use committed use discounts
- Monitor utilization
- Choose the correct machine family
- Use custom machine types
Optimization should never compromise reliability.
Security and Networking
12. How is Compute Engine secured?
Security features include:
- IAM
- Firewall rules
- Service Accounts
- Shielded VMs
- OS Login
- VPC isolation
- Customer-managed encryption keys
- Secure Boot
- Integrity Monitoring
Production recommendations:
- Least privilege
- Private IPs whenever possible
- No hardcoded credentials
- Regular patching
- Secret Manager for secrets
Production Concepts
13. What are startup scripts?
Startup scripts automatically execute commands when a VM starts.
Common uses:
- Install software
- Configure applications
- Register monitoring agents
- Download artifacts
- Configure logging
- Join clusters
Example flow:
VM Starts
↓
Startup Script Runs
↓
Application Ready
Startup scripts help automate infrastructure deployment.
14. What are Compute Engine best practices for production?
Recommended practices:
- Multi-zone deployment
- Managed Instance Groups
- Load balancing
- Autoscaling
- Health checks
- Persistent Disks
- IAM least privilege
- Monitoring
- Logging
- Backup snapshots
- Infrastructure as Code
- Cost monitoring
Avoid deploying production applications on a single VM.
15. How would you design a production-ready Compute Engine architecture?
Example architecture:
Users
│
▼
Global HTTP Load Balancer
│
▼
Managed Instance Group
┌──────┼──────┐
▼ ▼ ▼
VM1 VM2 VM3
│ │ │
└───────┼──────┘
▼
Persistent Disks
│
▼
Cloud SQL
Monitoring
Logging
IAM
Cloud Armor
Benefits:
- High availability
- Fault tolerance
- Autoscaling
- Security
- Easy maintenance
- Cost optimization
Production Scenario
Enterprise Spring Boot Deployment
Requirements:
- 99.99% availability
- Autoscaling
- Secure APIs
- Disaster recovery
Architecture:
Internet
│
▼
Cloud Load Balancer
│
▼
Managed Instance Group
│
┌───┼────┐
▼ ▼ ▼
VM VM VM
│ │ │
└───┼────┘
▼
Cloud SQL
│
▼
Cloud Storage
Cloud Monitoring
Cloud Logging
Secret Manager
Benefits:
- Automatic recovery
- Automatic scaling
- Secure architecture
- Reduced downtime
Managed Instance Group Architecture
Load Balancer
│
▼
Managed Instance Group
│
┌────┼────┐
▼ ▼ ▼
VM1 VM2 VM3
│
▼
Health Checks
Compute Engine Architecture
Application
│
▼
Compute Engine VM
│
┌────┼────┐
▼ ▼ ▼
CPU Memory Disk
│
▼
Network
VM Lifecycle
Create VM
│
▼
Boot
│
▼
Startup Script
│
▼
Application Running
│
▼
Monitoring
│
▼
Stop/Delete
Best Practices Checklist
✓ Use Managed Instance Groups
✓ Deploy Across Multiple Zones
✓ Enable Autoscaling
✓ Configure Health Checks
✓ Use Startup Scripts
✓ Choose Correct Machine Family
✓ Use Custom Machine Types
✓ Use Persistent Disks
✓ Take Regular Snapshots
✓ Configure IAM Least Privilege
✓ Enable Cloud Monitoring
✓ Enable Cloud Logging
✓ Schedule Non-Production VMs
✓ Use Spot VMs for Batch Jobs
✓ Use Infrastructure as Code
Quick Revision
| Topic | Key Point |
|---|---|
| Compute Engine | Google Cloud Virtual Machines |
| Machine Type | CPU and memory configuration |
| Custom Machine | User-defined CPU and memory |
| Persistent Disk | Durable block storage |
| Local SSD | Temporary high-speed storage |
| Image | VM template |
| Snapshot | Disk backup |
| Managed Instance Group | Auto-managed VM group |
| Autoscaling | Automatic scaling |
| Auto Healing | Automatic VM replacement |
| Spot VM | Low-cost interruptible VM |
| Startup Script | Runs during VM boot |
| Shielded VM | Enhanced VM security |
| Health Check | Detects unhealthy VMs |
| Production Best Practice | Multi-zone deployment |
Interview Tips
During Compute Engine interviews:
- Explain the difference between Persistent Disk and Local SSD.
- Compare predefined and custom machine types.
- Discuss Managed Instance Groups, autoscaling, and auto healing together.
- Mention Spot VMs for fault-tolerant workloads only.
- Recommend startup scripts and Infrastructure as Code for automation.
- Explain production deployments using load balancers, multiple zones, health checks, and Cloud Monitoring.
- Emphasize security with IAM, Shielded VMs, OS Login, and Service Accounts.
- Highlight cost optimization through rightsizing, autoscaling, and committed use discounts.
Summary
Google Compute Engine provides highly configurable Virtual Machines for enterprise workloads.
Key concepts include:
- Virtual Machines
- Machine Families
- Custom Machine Types
- Persistent Disks
- Local SSDs
- Images
- Snapshots
- Managed Instance Groups
- Autoscaling
- Auto Healing
- Spot VMs
- Startup Scripts
- Security
- High Availability
- Cost Optimization
Mastering these 15 Compute Engine interview questions prepares you for Google Cloud Engineer, Associate Cloud Engineer, Professional Cloud Architect, DevOps Engineer, Platform Engineer, Site Reliability Engineer, Technical Lead, and Solution Architect interviews.