Summary of Part 1
If you have not gone through Part-1, please go through it by following the link below,
Mastering the Fundamentals of Google Compute Engine (GCE) – Part 1 – TechNews (mydailytechai.com)
If you are just refreshing your memories, there here is a quick summary of Part-1. Mastering the Fundamentals of Google Compute Engine (GCE): In this blog post, you learned the basics of Google Compute Engine, which was a service that allowed you to create and run virtual machines on Google’s infrastructure. You also learned how to set up a GCE project, create and manage GCE instances, understand GCE networking and security, and understand GCE components. By the end of this post, you had a solid foundation of GCE and were ready to explore its advanced features and use cases.
Let us dive into the 2nd section of the GCE topics,
- Creating a Google Cloud Platform (GCP) Account
- Setting up Google Compute Engine (GCE) Project
- Creating and Managing GCE Instances
- Understanding GCE Networking and Security
- Understanding Google Compute Engine Components
- Creating a Google Cloud Platform (GCP) Account: If you want to use the amazing services offered by GCP, such as Google Compute Engine, Google Cloud Storage, and Google Kubernetes Engine, you need to create a GCP account first. Creating a GCP account is easy and free. All you need is a Google account and a credit card. You can sign up for the free trial and get $300 in free credits to explore and use GCP for 90 days. You can also choose a paid plan that suits your needs and budget. Once you have created your GCP account, you can access the Google Cloud Console, which is the web-based interface for managing your projects and resources on GCP.
- Step 1: Go to https://console.cloud.google.com/ and click on TRY IT FREE.
- Step 2: Log in with your Google account and choose your country and accept the terms and conditions.
- Step 3: Enter your billing information (credit or debit card details) and verify your identity. You will not be charged unless you upgrade to a paid plan.
- Step 4: You will get $300 in free credits and 90 days to use them on any GCP service. You can also choose a free plan that offers limited usage of some services.
- Step 5: You can access the Google Cloud Console, which is the web-based interface for managing your projects and resources on GCP.
- Setting up Google Compute Engine (GCE) Project: A project is a way of organizing and grouping your resources on GCP. You can have multiple projects for different purposes and applications. To use Google Compute Engine, which is the service that lets you create and run virtual machines on Google’s infrastructure, you need to set up a GCE project first. Setting up a GCE project is simple and quick. You just need to go to the Cloud Console, create a new project or select an existing one, and enable the Compute Engine API. You can also configure some settings for your project, such as quotas, permissions, and networking.
- Step 1: Go to https://cloud.google.com/ and sign up for Google Cloud Platform (GCP) using your Google account. You will get $300 in free credits and 90 days to use them on any GCP service.
- Step 2: Go to the Google Cloud Console at https://console.cloud.google.com/ and create a new project or select an existing one. A project is a way of organizing and grouping your resources on GCP.
- Step 3: Enable the Compute Engine API for your project. You can do this by clicking on Navigation menu > APIs & Services > Library and searching for Compute Engine API. Click on Enable to activate the service.
- Step 4: Configure some settings for your project, such as quotas, permissions, and networking. You can do this by clicking on Navigation menu > IAM & Admin > Quotas and requesting more resources if needed. You can also click on Navigation menu > VPC network > Firewall rules and creating or editing rules to control the traffic to and from your instances.
- You have now successfully set up a GCE project. You can now create and manage virtual machines (VMs) that run on Google’s infrastructure using GCE.
- Creating and Managing GCE Instances: A GCE instance is a virtual machine that runs on Google’s infrastructure. You can create and customize your instances according to your needs and preferences. You can choose from various options, such as machine types, images, disks, network interfaces, and GPUs. You can also use preconfigured templates or instance groups to create multiple instances at once. To create and manage your instances, you can use the Cloud Console, the gcloud command-line tool, or the REST API. You can perform various operations on your instances, such as start, stop, delete, and modify. You can also monitor and troubleshoot your instances using logs, metrics, and alerts.
- Example 1: Creating and managing a Linux instance using the Google Cloud console.
- Go to the VM instances page in the Google Cloud console and click on Create instance.
- Enter a name for your instance and choose a region and a zone for it.
- Choose a machine type that suits your needs and budget. You can use the default general-purpose machine type or select a different one from the list.
- Choose a boot disk image for your instance. You can use the default Debian image or select a different one from the list of public images or custom images. You can also change the size and type of the boot disk if needed.
- Optionally, you can configure other settings for your instance, such as network interfaces, firewall rules, service accounts, metadata, and labels.
- Click on Create to create your instance. It may take a few minutes for your instance to start running.
- To connect to your instance using SSH, click on the SSH button next to your instance name. A new browser window will open with an SSH terminal session.
- To stop, start, reset, or delete your instance, click on the three-dot menu next to your instance name and select the desired action.
- Example 2: Creating and managing a Windows Server instance using the gcloud command-line tool.
- Install and initialize the gcloud tool on your local machine. Make sure you have set a default project, region, and zone for your commands.
- Run the following command to create a Windows Server instance with a random password:
gcloud compute instances create [INSTANCE_NAME] \
--image-family=windows-2019 \
--image-project=windows-cloud \
--metadata windows-startup-script-ps1="Set-ExecutionPolicy Unrestricted; Enable-PSRemoting -Force"
- Replace
[INSTANCE_NAME]
with the name of your instance. - Run the following command to get the password for your instance:
gcloud compute reset-windows-password [INSTANCE_NAME]
. Replace[INSTANCE_NAME]
with the name of your instance. Note down the username and password that are displayed in the output. - To connect to your instance using RDP, you need to install an RDP client on your local machine. You can use any RDP client that supports NLA authentication, such as Microsoft Remote Desktop Connection or Chrome RDP for Google Cloud.
- Launch your RDP client and enter the external IP address of your instance. Enter the username and password that you obtained in the previous step. You should see the Windows Server desktop on your RDP session.
- To stop, start, reset, or delete your instance, run one of the following commands:
gcloud compute instances stop [INSTANCE_NAME]
gcloud compute instances start [INSTANCE_NAME]
gcloud compute instances reset [INSTANCE_NAME]
gcloud compute instances delete [INSTANCE_NAME]
- Replace
[INSTANCE_NAME]
with the name of your instance.
- Example 1: Creating and managing a Linux instance using the Google Cloud console.
- Understanding GCE Networking and Security: Networking and security are important aspects of cloud computing. You want to make sure that your instances can communicate with each other and with the internet securely and efficiently. GCE provides various features and tools to help you with networking and security. You can use VPC networks to create isolated virtual networks for your instances. You can use firewalls to control the traffic to and from your instances. You can use load balancers to distribute the traffic across your instances. You can use VPNs to connect your VPC networks with other networks securely. You can use Cloud DNS to manage domain names for your instances. You can use Cloud CDN to deliver content faster to your users. You can also use IAM roles, service accounts, SSH keys, and encryption keys to manage access and protect your data.
- Understanding Google Compute Engine Components: Google Compute Engine is a complex and powerful service that consists of several components that work together to provide a scalable and reliable cloud computing platform. Some of the main components are:
- Zones and regions: These are geographical locations where you can run your instances. Zones are isolated from each other within a region, and regions are isolated from each other across the world. You can choose zones and regions based on availability, latency, and cost.
- Machine types: These are predefined configurations of CPU, memory, disk, and network resources that you can assign to your instances. You can choose from general-purpose, memory-optimized, compute-optimized, or custom machine types depending on your workload.
- Images: These are bootable disks that contain the operating system and software for your instances. You can use public images provided by Google or other vendors, or create your own custom images from existing disks or snapshots.
- Disks: These are persistent storage devices that you can attach to your instances. You can use standard hard disk drives (HDDs), solid state drives (SSDs), or local SSDs depending on your performance and durability requirements.
- Snapshots: These are incremental backups of your disks that you can use to restore your data or create new disks or images. Snapshots are stored in Cloud Storage and are charged according to the amount of data stored.