# GCP Compute Engine

### *What is a GCE virtual machine?*

*Google Compute Engine lets you create a virtual computer in the cloud. Google manages the physical server, and you use a virtual machine (VM) to run your applications.*

*A VM has resources such as:*

*CPU: How much processing work it can do.\
Memory (RAM): How much data and how many programs it can handle at once.\
Disk: Where the operating system, files, and applications are stored.\
Network: How it communicates with other systems and the internet.*

*For example, suppose you create a Linux VM to practice commands, install Docker, and run a small application. You need to decide how powerful that virtual computer should be.*

#### *Key building blocks*

| *Concept* | *Meaning* |
| --- | --- |
| *Instance* | *The VM itself* |
| *Image* | *The OS and software the VM starts with* |
| *Machine family* | *The category of hardware* |
| *Machine type* | *The exact CPU and memory size* |
| *Hyperdisk / Persistent Disk* | *Virtual hard disks (block storage) attached to the VM* |

### **What is a machine family?**

*A machine family is a category of VMs designed for a particular kind of workload.*

***Analogy:*** *Think of buying a vehicle. You might choose a small car, a truck, or a sports car depending on your needs. They are all vehicles, but each is designed for different work.*

*GCP machine families work similarly.*

| Family | Letters | Best for |
| --- | --- | --- |
| General purpose | E2, N2, C3, N4 | *For everyday applications, small servers, web applications, development, and testing.* |
| Memory optimized | M3, M4, X | *For applications that need very large amounts of RAM, such as large in-memory databases.* |
| Compute optimized | C3, H | *For CPU-intensive work such as scientific calculations, high-performance web services, and intensive data processing.* |
| Storage optimized | Z | *Big data and data warehouses (fast disk I/O)* |
| Accelerator optimized | A, G | *For demanding GPU workloads such as AI training and high-performance computing.* |

*Remember: The family tells you the general purpose and design of the VM. It does not tell you the exact amount of CPU and RAM you will get.*

### **What is a machine type?**

*A machine type tells you the actual CPU and RAM resources your VM will receive.*

*For example, imagine you choose the E2 machine series. You can select a smaller or larger machine type depending on your workload.*

Here is an example using E2 machine types:

| Machine type | vCPUs | Memory (RAM) |
| --- | --- | --- |
| `e2-small` | Shared-core | 2 GB |
| `e2-medium` | Shared-core | 4 GB |
| `e2-standard-2` | 2 | 8 GB |
| `e2-standard-4` | 4 | 16 GB |

*Let's break down one example: e2-standard-2 --> 2 vCPUs, 8 GB RAM*\
*e2 = the machine series.*\
*standard = a balanced CPU-to-memory configuration.*\
*2 = two vCPUs.*

*This is a general-purpose VM configuration suitable for many small applications and learning exercises.*

### Hands-on: How to choose a machine family and type in GCP and create VMs.

*Step 1 — Open Compute Engine*

*Go to the* [*Google Cloud Console*](https://console.cloud.google.com/?utm_source=chatgpt.com)*, select your project, then navigate to Compute Engine → VM instances → Create instance.*

![](https://cdn.hashnode.com/uploads/covers/668a9cde782d9687087baab0/45d77673-4a24-47a0-bd54-a80c5a257eff.png align="center")

![](https://cdn.hashnode.com/uploads/covers/668a9cde782d9687087baab0/27d10c93-b9e1-425e-81a9-386b1547c157.png align="center")

Step 2 — Select a machine configuration

*Find the Machine configuration section. Depending on the current console layout, you'll see options for the machine family, series, and machine type.*

![](https://cdn.hashnode.com/uploads/covers/668a9cde782d9687087baab0/8ecb93d9-3d86-4c62-9861-6b46d158f52a.png align="center")

*Step 3 — Choose a family and type*

*For a basic learning VM, select General-purpose → E2, then choose an appropriately small machine type available to your project and zone.*

![](https://cdn.hashnode.com/uploads/covers/668a9cde782d9687087baab0/7b4bee74-9c96-43b2-a31a-b8fd09427403.png align="center")

*Step 4 — Choose OS and storage*

\*An image decides what OS and software your VM runs.\
\****Public images*** *are ready-made (Debian, Ubuntu, Windows Server, SQL Server).*

![](https://cdn.hashnode.com/uploads/covers/668a9cde782d9687087baab0/8c6bfafe-5dc4-4d14-8261-653452fd45d5.png align="center")

*Step 5 — Choose networking for communication.*

![](https://cdn.hashnode.com/uploads/covers/668a9cde782d9687087baab0/ce3bcdb3-b9f5-4ed2-894b-fa71e791c89b.png align="center")

*Step 6 — Review and create*

![](https://cdn.hashnode.com/uploads/covers/668a9cde782d9687087baab0/35e66338-3c01-4140-bc8a-b900a5e198ea.png align="center")

*Hands-on: HTTP server*

*Connect to the VM via SSH*

![](https://cdn.hashnode.com/uploads/covers/668a9cde782d9687087baab0/484265da-0c5e-4128-a7d5-dfba464208d9.png align="center")

*Task: Install Apache Server on VM*

![](https://cdn.hashnode.com/uploads/covers/668a9cde782d9687087baab0/dadea0b4-9848-49c6-907b-833193b73f8f.png align="center")

![](https://cdn.hashnode.com/uploads/covers/668a9cde782d9687087baab0/afef683b-01cc-400f-a523-7feec9a6fb1e.png align="center")

![](https://cdn.hashnode.com/uploads/covers/668a9cde782d9687087baab0/afef683b-01cc-400f-a523-7feec9a6fb1e.png align="center")

![](https://cdn.hashnode.com/uploads/covers/668a9cde782d9687087baab0/5eb0a356-755d-4e5f-866c-aa7d597a71d6.png align="center")

### *Your takeaway*

*Remember this simple rule: Choose the family based on the workload, then choose the machine type based on the resources you need.*
