|
| 1 | +Author: Benjamin Du |
| 2 | +Date: 2023-07-01 17:57:54 |
| 3 | +Modified: 2025-05-08 12:15:01 |
| 4 | +Title: GCP Compute Engine VM Instances |
| 5 | +Slug: gcp-compute-engine-vm-instances |
| 6 | +Category: Computer Science |
| 7 | +Tags: Computer Science, programming, cloud, GCP, VM, compute engine, spot, Google |
| 8 | + |
| 9 | +**Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!** |
| 10 | + |
| 11 | +## GCP |
| 12 | + |
| 13 | +GCP c2 and c3 VMs are good choices according to performance per price. |
| 14 | +It's even cheaper than customized VM types with reduced memories! |
| 15 | +GCP c2 VMs are compute optimized and are ideal for CPU intensive workloads. |
| 16 | +Note that GCP c2 spot VMs are even cheaper than AWS t2.nano VMs |
| 17 | +if you can stand your VM being preempted. |
| 18 | + |
| 19 | + |
| 20 | + |
| 21 | + |
| 22 | + |
| 23 | +## Create GCP VMs Using Command Line |
| 24 | + |
| 25 | +``` |
| 26 | +gcloud compute instances create instance-20240304-20240304-064337 \ |
| 27 | + --project=crested-studio-416206 \ |
| 28 | + --zone=northamerica-northeast1-c \ |
| 29 | + --machine-type=e2-medium \ |
| 30 | + --network-interface=network-tier=PREMIUM,stack-type=IPV4_ONLY,subnet=default \ |
| 31 | + --maintenance-policy=MIGRATE \ |
| 32 | + --provisioning-model=STANDARD \ |
| 33 | + --service-account=170261695503-compute@developer.gserviceaccount.com \ |
| 34 | + --scopes=https://www.googleapis.com/auth/cloud-platform \ |
| 35 | + --tags=https-server,lb-health-check \ |
| 36 | + --create-disk=auto-delete=yes,boot=yes,device-name=instance-20240304-062735,image=projects/ubuntu-os-cloud/global/images/ubuntu-2204-jammy-v20240228,mode=rw,size=10,type=projects/crested-studio-416206/zones/northamerica-northeast1-c/diskTypes/pd-balanced \ |
| 37 | + --no-shielded-secure-boot \ |
| 38 | + --shielded-vtpm \ |
| 39 | + --shielded-integrity-monitoring \ |
| 40 | + --labels=goog-ec-src=vm_add-gcloud \ |
| 41 | + --reservation-affinity=any |
| 42 | +``` |
| 43 | +## Query GCP VMs |
| 44 | + |
| 45 | +``` |
| 46 | +gcloud compute instances list --format='table(name,status,lastStartTimestamp,lastStopTimestamp.list())' |
| 47 | +``` |
| 48 | + |
| 49 | +## Google Cloud Logging |
| 50 | + |
| 51 | +https://console.cloud.google.com/logging |
| 52 | + |
| 53 | +## References |
| 54 | + |
| 55 | +- [Comparison of Popular Cloud Platforms]( https://www.legendu.net/misc/blog/comparison-of-popular-cloud-platforms ) |
| 56 | + |
| 57 | +- [GCP - Create a VM with a custom machine type](https://cloud.google.com/compute/docs/instances/creating-instance-with-custom-machine-type) |
| 58 | + |
| 59 | +- [GCP - Free cloud features and trial offer](https://cloud.google.com/free/docs/free-cloud-features#compute) |
| 60 | + |
| 61 | +- [GCP - Choosing the right virtual machine type](https://cloud.google.com/compute#section-6) |
| 62 | + |
| 63 | +- [GCP Product Calculator](https://cloud.google.com/products/calculator) |
| 64 | + |
| 65 | +- [GCP - Compute Engine Pricing](https://cloud.google.com/compute/all-pricing) |
| 66 | + |
| 67 | + |
0 commit comments