GCP Project Setup and First Compute Engine VM
GCP Project Setup and First Compute Engine VM
Google Cloud Platform (GCP) stands out in the cloud market with its premium network infrastructure and per-second billing model. This guide walks you through creating a GCP project and deploying your first Compute Engine virtual machine from scratch.
Understanding GCP Projects
In GCP, all resources belong to a Project. A project is the fundamental unit for resource isolation, billing, and access control. Each project has a unique Project ID, and all API enablement, quota management, and IAM policies operate at the project level.
Unlike AWS, which manages resources at the account level, GCP's project hierarchy lets you create multiple fully isolated environments under a single account—ideal for separating development, staging, and production workloads.
Step 1: Create a GCP Project
Sign Up for GCP
Visit cloud.google.com and sign in with your Google account. New users receive a $300 free credit valid for 90 days.
Create the Project
- Open the GCP Console and click the project selector at the top
- Click New Project
- Enter a project name (e.g.,
my-first-project); the system auto-generates a unique Project ID - Select an organization (if applicable) and location
- Click Create
Set Up Billing
Navigate to Billing and link a credit card. GCP uses post-pay billing—you only pay for resources while they run. The e2-micro instance type offers a free tier in select regions.
Step 2: Configure VPC Networking
Before creating a VM, understand GCP's VPC structure:
| Component | GCP Behavior | vs. Alibaba Cloud | |-----------|-------------|------| | VPC Network | Global resource, spans regions | Regional VPC | | Subnet | Regional resource | Regional | | Firewall Rules | Configured at VPC level | Security group level | | Route Tables | Automatic or custom | Manual configuration required |
GCP provides a default VPC with auto-created subnets in each region. For production workloads, we recommend creating a custom VPC.
Step 3: Create a Compute Engine VM
Navigate to Compute Engine
Search for "Compute Engine" in the console, or go to Compute Engine → VM instances. The API will enable automatically on first access.
Configure the Instance
Click Create Instance and set the following:
| Setting | Recommended Value | Notes |
|---------|-------------------|-------|
| Name | my-first-vm | Lowercase letters, numbers, hyphens |
| Region | asia-east1 (Taiwan) | Low latency for Asia-Pacific |
| Zone | asia-east1-a | Single-zone deployment |
| Machine type | e2-medium (2 vCPU, 4GB) | Balanced cost-performance |
| Boot disk | Debian 12 | Stable and free |
| Disk size | 20GB SSD | Sufficient for basic needs |
| Firewall | Allow HTTP/HTTPS traffic | Check to open web ports |
Instance Type Selection Guide
GCP offers several machine families. Here are pricing references for the asia-east1 region:
| Machine Type | vCPU | Memory | On-Demand ($/mo) | Use Case | |-------------|------|--------|-------------------|----------| | e2-micro | 2 | 1GB | ~$6.11 | Lightweight testing | | e2-small | 2 | 2GB | ~$12.23 | Dev environments | | e2-medium | 2 | 4GB | ~$24.46 | Moderate workloads | | n2-standard-4 | 4 | 16GB | ~$133.73 | Production apps | | n2-highmem-4 | 4 | 26GB | ~$179.23 | Memory-intensive |
Compared to Tencent Cloud CVM instances, GCP's E2 series achieves lower unit costs through intelligent scheduling, making them ideal for workloads that don't require sustained full CPU utilization.
Network and Security
- External IP: Choose "Ephemeral" or "Static" (static IPs cost ~$7.30/month when unattached)
- SSH Keys: Add your public SSH key under the Security section
- Service Account: Defaults to the Compute Engine default service account
Step 4: Connect to Your VM
Browser SSH
Click the SSH button next to your instance in the VM instances list. GCP opens a terminal window in your browser—the simplest connection method.
gcloud CLI
# After installing gcloud CLI
gcloud compute ssh my-first-vm --zone=asia-east1-a
Third-Party SSH Client
- Get the external IP from the instance details page
- Connect using your key:
ssh -i ~/.ssh/my-key username@EXTERNAL_IP
Basic Operations
Disk Expansion
# After resizing the disk in the console, run inside the VM:
sudo resize2fs /dev/sda1
Snapshots and Images
Create disk snapshots regularly for data protection. GCP snapshots use incremental storage—the first snapshot costs approximately $0.026/GB/month, and subsequent snapshots only store changed data.
Stopping vs. Deleting
- Stop: Retains configuration and disks; compute charges stop (disk charges continue)
- Delete: Releases all resources; choose whether to delete attached disks
Cost Optimization Tips
- Committed Use Discounts: 1-year or 3-year commitments save 20%–57%
- Preemptible VMs: Suitable for batch processing at up to 80% off regular pricing
- Autoscaling: Combine with Managed Instance Groups for elastic scaling
- Resource Labels: Use labels for cost attribution and budget alerts
Security Best Practices
- Enable VPC Service Controls to protect sensitive data
- Follow least-privilege principles with Cloud IAM
- Rotate SSH keys regularly
- Enable Cloud Audit Logging for operational audit trails
- Configure Organization Policies to restrict resource creation regions
Conclusion
Getting started with GCP Compute Engine is straightforward—from project creation to a running VM typically takes under 15 minutes. Per-second billing and flexible machine types offer enterprises exceptional cost agility.
As a multi-cloud service partner, Duoyun Cloud provides GCP resource procurement with exclusive discounts. By ordering through Duoyun, you gain better pricing than going direct, plus Chinese-language technical support and unified multi-cloud management. Whether you're moving to the cloud for the first time or optimizing your existing GCP architecture, Duoyun delivers professional solutions and competitive pricing. Visit duoyun.io to learn more.
Need Professional Cloud Consulting?
Our cloud architect team will customize the best solution for you — free
Free Consultation