Day5 - Google Compute Engine(GCE) - Creating and Managing Virtual Machines
Google Compute Engine (GCE) - Creating and Managing Virtual Machines
Google Compute Engine (GCE) is a cloud service that lets you create and manage virtual machines (VMs) on Google’s infrastructure. This guide will help you get started with creating and managing VMs using GCE.
What are Virtual Machines (VMs)?
VMs are software versions of physical computers. They offer a dedicated set of resources like CPU, memory, storage, and an operating system. GCE provides various VM configurations for different needs, such as web servers, databases, and advanced AI applications.
Benefits of Using GCE VMs
Scalability: Easily adjust your VMs to meet changing demands.
Cost-Effectiveness: Pay only for what you use with GCE's pay-per-use model.
High Performance: Use Google’s powerful and reliable cloud infrastructure.
Variety of Options: Choose from many pre-configured machine types or customize VMs to fit specific needs.
Managed Service: Google manages the underlying infrastructure so you can focus on your applications.
Getting Started with GCE VMs
There are two main ways to create VMs in GCE:
Cloud Console:
A user-friendly web interface for creating and managing VMs. Let me guide you using Google Cloud Console:
Navigate to Google Cloud search bar and type "Compute Engine"
Click on "Create instance"
Complete the details such as write your VM name, region, zone, machine configuration. If you are using Free tier account, you can use E2 series. In my case I used "e2-medium". You can use "e2-micro".
Allow HTTP or HTTS traffic if you want
You can create labels and tags for your VM.
In the Availability policies, please select the Standard. Don't select the Spot instance because it can be terminated any time.
Now, click on create and your VM will be create in few seconds. If you are using GCP first time it might take 1-2 minute.
gcloud Command-Line Tool:
A powerful tool for managing VMs through scripts and automation. Let me guide you how to create a VM using CLI. please follow below URL with complete documentation:
Managing VMs
GCE provides several tools to manage your VMs:
Start, Stop, and Reset: Control the power state of your VMs.
View VM Details: See detailed information about your VMs, such as resource use and network settings.
SSH Access: Securely connect to your VMs using SSH for software management.
VNC or Serial Console Access: Use VNC or serial console for GUI-based OS troubleshooting.
VM Snapshots: Create snapshots of your VM’s state for backup or rollback purposes.
Firewall Rules: Manage firewall rules to control network traffic.
Monitoring and Logging: Monitor VM health and performance and access logs for troubleshooting.
Additional Considerations
Security: Set up firewall rules and access controls to secure your VMs.
Persistent Disks: Use persistent disks for data that needs to survive VM restarts.
Auto Scaling: Automatically scale your VMs up or down based on predefined metrics.
Cost Management: Track your VM resource usage and use features like committed use discounts to save costs.
Resources
Google Cloud Documentation: https://cloud.google.com/compute/docs/instances/create-start-instance
Creating a Virtual Machine - Skills Boost: https://m.youtube.com/watch?v=g2Il8cxNv18
Google Compute Engine: https://cloud.google.com/compute/docs/machine-resource
Subscribe to my newsletter
Read articles from Karan Singh Rajawat directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Karan Singh Rajawat
Karan Singh Rajawat
I am a Senior Software Engineer at Cross Country Healthcare. I have 8+ year experience in Infrastructure and CloudOps and three AWS certifications: Cloud Practitioner, Solutions Architect - Associate, and SysOps Administrator - Associate. I started my career as a Service Desk Engineer, where I built a strong foundation in IT support and customer service. I then transitioned to on-premise infrastructure, where I gained valuable experience in diverse technologies and platforms. Inspired by the rapid growth of cloud computing, I specialized in AWS CloudOps.