<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[GCP - Google Cloud Provider]]></title><description><![CDATA[GCP - Google Cloud Provider]]></description><link>https://terraform-project-spotify-playlist.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Wed, 04 Nov 2026 06:30:46 GMT</lastBuildDate><atom:link href="https://terraform-project-spotify-playlist.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Reducing VM costs, Observability of VM, Sole-tenant nodes, Live Migra]]></title><description><![CDATA[If a VM runs for more than 25% of a month, GCP automatically starts lowering the hourly rate. If it runs 24/7 for the whole month, you get up to a 30%…]]></description><link>https://terraform-project-spotify-playlist.hashnode.dev/reducing-vm-costs-observability-of-vm-sole-tenant-nodes-live-migra</link><guid isPermaLink="true">https://terraform-project-spotify-playlist.hashnode.dev/reducing-vm-costs-observability-of-vm-sole-tenant-nodes-live-migra</guid><dc:creator><![CDATA[Vibhuti Jain]]></dc:creator><pubDate>Sat, 31 Oct 2026 18:40:02 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/668a9cde782d9687087baab0/ae8fb723-b2da-47ad-a39d-5c7be5fc40d4.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h3>1. Sustained Use Discounts (SUDs)</h3>
<p><em>If a VM runs for more than 25% of a month, GCP automatically starts lowering the hourly rate. If it runs 24/7 for the whole month, you get up to a</em> <em><strong>30% discount</strong></em> <em>automatically.</em></p>
<ul>
<li><em><strong>Best for:</strong></em> <em>Casual or unpredictable workloads where you forgot to plan, but the VM ended up running for a long time anyway.</em></li>
</ul>
<p><strong>2. Committed Use Discounts (CUDs)</strong></p>
<p><em>You officially promise GCP that you will use a certain amount of vCPUs/RAM (Resource-based) or spend a specific dollar amount (Spend-based) for</em> <em><strong>1 or 3 years</strong></em><em>. In return, GCP cuts your bill by</em> <em><strong>up to 70%</strong></em><em>.</em></p>
<ul>
<li><em><strong>Best for:</strong></em> <em>Predictable, permanent, 24/7 production workloads that you know your company will run for years.</em></li>
</ul>
<h3>3. Spot VMs</h3>
<p><em>GCP sells you their leftover, unused computer power at a massive</em> <em><strong>60% to 91% discount</strong></em><em>. The catch?</em> <em><strong>GCP can shut down your VM with only a 30-second warning.</strong></em> <em>If a regular customer needs that hardware.</em></p>
<ul>
<li><em><strong>Best for:</strong></em> <em>Jobs that can be safely interrupted and restarted later—like data processing, batch jobs, testing environments, or stateless apps.</em></li>
</ul>
<h3>What is Observability?</h3>
<p><em>If</em> <em><strong>Monitoring</strong></em> <em>tells you that something is broken,</em> <em><strong>Observability</strong></em> <em>tells you why it broke.</em></p>
<p><em>In GCP, observability is handled by a suite of tools called the</em> <em><strong>Google Cloud Operations Suite</strong></em><em>. It relies on three main pillars:</em> <em><strong>Metrics, Logs, and Traces.</strong></em></p>
<p><em>The Three Pillars of GCP Observability</em></p>
<ol>
<li><em>Metrics (Cloud Monitoring) —</em> <em><strong>The Dashboard Gauges</strong></em></li>
</ol>
<p><em><strong>What it is:</strong></em> <em>Numeric data measured over time. It tells you the health and performance of your system.</em></p>
<p><em><strong>In GCP:</strong></em> <em>It shows you graphs of</em> <em><strong>CPU usage, memory usage, network traffic, or disk read/write speeds</strong></em> <em>on your VMs or Kubernetes clusters.</em></p>
<ol start="2">
<li><em>Logs (Cloud Logging)</em> <em><strong>— The Black Box Recorder</strong></em></li>
</ol>
<p><em><strong>What it is:</strong></em> <em>A text-based, chronological diary of every single event that happens in your system.</em></p>
<p><em><strong>In GCP:</strong></em> <em>It records things like "User Tony logged in at 11:25 PM", "Database connection failed", or "Auth service returned a 500 error."</em></p>
<ol start="3">
<li><em>Traces (Cloud Trace)</em> <em><strong>— The Delivery Tracker</strong></em></li>
</ol>
<p><em><strong>What it is:</strong></em> <em>Tracks a single user request as it travels through a complex system of multiple microservices or VMs</em></p>
<p><em><strong>In GCP:</strong></em> <em>If a user clicks "Buy Now" and the webpage takes 5 seconds to load, Cloud Trace shows you: Frontend took 0.1s → Auth service took 0.2s →</em> <em><strong>Payment Gateway took 4.7s</strong></em><em>. You instantly know where the bottleneck is.</em></p>
<h3><em>What are sole-tenant nodes?</em></h3>
<p><em>Imagine</em> <em><strong>renting the entire physical building</strong></em> <em>for yourself. Nobody else can live there. You can put your own family members (your individual VMs) into different rooms, but absolutely no strangers are allowed inside the physical structure.</em></p>
<p>Why would someone pay extra for this?</p>
<ul>
<li><em><strong>Security or compliance:</strong></em> <em>PCI-DSS, HIPAA, FedRAMP.</em></li>
<li><em><strong>Licensing:</strong></em> <em>some software, like Windows Server or SQL Server, is licensed per physical core or processor.</em></li>
<li><em><strong>Company policy:</strong></em> <em>requires dedicated hardware.</em></li>
</ul>
<p><em>A</em> <em><strong>sole-tenant node</strong></em> <em>is an entire physical server dedicated to you. It works with the same machine types and images.</em></p>
<h3>What is Live Migration in GCP?</h3>
<p><em>Google sometimes needs to do maintenance on the physical host your VM runs on. With</em> <em><strong>live migration</strong></em><em>, your running VM is moved to another host in the same zone</em> <em><strong>without stopping</strong></em> <em>and without changing its properties. Triggers include infrastructure maintenance and hardware failures.</em></p>
<p><em>You configure it under the</em> <em><strong>availability policy</strong></em><em>:</em></p>
<ol>
<li><em><strong>On host maintenance:</strong></em> <em>Migrate (the default when supported) moves the VM to other hardware, while Terminate stops it.</em></li>
<li><em><strong>Automatic restart:</strong></em> <em>restarts the VM if it was terminated for non-user reasons, such as a hardware failure.</em></li>
</ol>
]]></content:encoded></item><item><title><![CDATA[Custom Images, Startup Scripts, and Instance Templates]]></title><description><![CDATA[In Google Cloud Platform (GCP), Custom Images, Startup Scripts, and Instance Templates are foundational tools for automating, standardizing, and scaling…]]></description><link>https://terraform-project-spotify-playlist.hashnode.dev/custom-images-startup-scripts-and-instance-templates</link><guid isPermaLink="true">https://terraform-project-spotify-playlist.hashnode.dev/custom-images-startup-scripts-and-instance-templates</guid><dc:creator><![CDATA[Vibhuti Jain]]></dc:creator><pubDate>Fri, 30 Oct 2026 19:55:43 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/668a9cde782d9687087baab0/ac6350ac-da8c-493f-ad43-fa1f719d43c3.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><em>In Google Cloud Platform (GCP),</em> <em><strong>Custom Images</strong></em><em>,</em> <em><strong>Startup Scripts</strong></em><em>, and</em> <em><strong>Instance Templates</strong></em> <em>are foundational tools for automating, standardizing, and scaling your Compute Engine virtual machine (VM) deployments.</em></p>
<h3>1. Custom Image</h3>
<p>A <em><strong>Custom Image</strong></em> <em>is a snapshot of a boot disk containing an operating system (OS) along with any pre-installed software, configurations, or data.</em></p>
<ul>
<li><em><strong>How it works:</strong></em> <em>Instead of starting from a plain, vanilla OS image provided by Google (like standard Ubuntu or Debian), you take an existing VM disk, install your application dependencies, security patches, or software stacks, and create a custom image from it.</em></li>
</ul>
<p>Key Benefits:</p>
<ul>
<li><em><strong>Faster Boot Times:</strong></em> <em>Because applications and packages are already baked into the image, your VMs don't need to download or install them from scratch every time they start.</em></li>
<li><em><strong>Consistency ("Golden Images"):</strong></em> <em>Ensures every server in your environment starts with the same software version and security configuration.</em></li>
</ul>
<p><em><strong>Note:</strong></em> <em>You must have the VM in GCP before creating a custom image.</em></p>
<h3><em>Step 1: Prepare Your Source VM</em></h3>
<ol>
<li><em>Go to the</em> <em><strong>VM instances</strong></em> <em>page in the GCP Console.</em></li>
<li><em>Identify the VM whose disk you want to capture as an image.</em></li>
<li><em><strong>Stop the VM.</strong></em> <em>(Important: To ensure data consistency and avoid corrupting files, the instance should be stopped before creating an image from its boot disk).</em></li>
</ol>
<img src="https://cdn.hashnode.com/uploads/covers/668a9cde782d9687087baab0/3d375ba2-47ba-4012-8d9e-df76798147a8.png" alt="" style="display:block;margin:0 auto" />

<img src="https://cdn.hashnode.com/uploads/covers/668a9cde782d9687087baab0/4b10f404-5532-4cd6-9ecd-d084aa053b3d.png" alt="" style="display:block;margin:0 auto" />

<h3><em>Step 2: Navigate to the Images Page</em></h3>
<ol>
<li><em>In the Google Cloud Console search bar at the top, type</em> <em><strong>Images</strong></em> <em>and select the</em> <em><strong>Images (Compute Engine)</strong></em> <em>service.</em></li>
<li><em>At the top of the page, click</em> <em><strong>+ Create image</strong></em><em>.</em></li>
</ol>
<img src="https://cdn.hashnode.com/uploads/covers/668a9cde782d9687087baab0/8ee55d5f-baad-4174-bcb9-2aa9f8a89c92.png" alt="" style="display:block;margin:0 auto" />

<h3><em>Step 3: Configure Your Custom Image</em></h3>
<ul>
<li><em>Name: Give your image a lowercase, hyphen-separated name (e.g.,</em> <code>my-custom-app-image-v1</code><em>).</em></li>
<li><em>Source: Select Disk.</em></li>
<li><em>Source disk: Choose the stopped VM instance or its specific boot disk from the dropdown menu.</em></li>
<li><em>Location: Choose whether you want the image stored in a Regional location (tied to a specific region for faster local creation) or Multi-regional (available across multiple regions).</em></li>
<li><em>Encryption: (Optional) Leave as Google-managed encryption key unless your organization requires a Customer-Managed Encryption Key (CMEK).</em></li>
<li><em>Family: (Optional) Enter an image family name (e.g.,</em> <code>web-servers</code><em>). Image families point to the latest image in that group automatically when used in templates.</em></li>
<li><em>Guest OS features: GCP usually auto-detects features like UEFI or multi-IP support based on your source disk, but you can configure them manually if needed.</em></li>
</ul>
<img src="https://cdn.hashnode.com/uploads/covers/668a9cde782d9687087baab0/f58d574b-f11f-4988-9c31-622ab580c60a.png" alt="" style="display:block;margin:0 auto" />

<h3><em>Step 4: Create the Image</em></h3>
<ol>
<li><em>Click</em> <em><strong>Create</strong></em> <em>at the bottom of the page.</em></li>
<li><em>GCP will take a few minutes to process the snapshot and build the image. Once complete, it will appear in your list of custom images, ready to be used in</em> <em><strong>Instance Templates</strong></em> <em>or new VM creations.</em></li>
</ol>
<img src="https://cdn.hashnode.com/uploads/covers/668a9cde782d9687087baab0/00a129f1-0c26-4fec-adbc-40aa5ee7be35.png" alt="" style="display:block;margin:0 auto" />

<h3>2. Startup Script (Bootstrapping)</h3>
<p><em>A</em> <em><strong>Startup Script</strong></em> <em>is a script (typically Bash for Linux or PowerShell for Windows) that you pass to a VM instance via metadata. The VM executes it automatically during boot.</em></p>
<p><em><strong>How it works:</strong></em> <em>When the VM boots up, the Compute Engine guest agent picks up the startup script from the instance metadata and runs it with root/administrator privileges.</em></p>
<p><em>How to add a script while creating a VM with a specific software configuration.</em></p>
<ul>
<li>Start creating your <strong>VM instance</strong> or <strong>Instance Template</strong> with all the configuration, and in <strong>Advance option,</strong> add the script.</li>
</ul>
<img src="https://cdn.hashnode.com/uploads/covers/668a9cde782d9687087baab0/68714fdf-7ba3-4ef0-9b2d-333536aaca96.png" alt="" style="display:block;margin:0 auto" />

<img src="https://cdn.hashnode.com/uploads/covers/668a9cde782d9687087baab0/0e02495c-2de6-4ffb-ab53-f60ca6313b98.png" alt="" style="display:block;margin:0 auto" />

<img src="https://cdn.hashnode.com/uploads/covers/668a9cde782d9687087baab0/f464f4ae-a562-433c-b64f-faa23531c95a.png" alt="" style="display:block;margin:0 auto" />

<p><em>Bootstrapping startup script works!!</em></p>
<h3>3. Instance Template</h3>
<p><em>An</em> <em><strong>Instance Template</strong></em> <em>is a global resource that acts as a reusable blueprint for creating VM instances or Managed Instance Groups (MIGs).</em></p>
<ul>
<li><em><strong>How it works:</strong></em> <em>It packages all the configuration settings required to launch a VM—such as the machine type (e.g.,</em> <code>e2-medium</code><em>), the boot disk (which can reference a</em> <em><strong>Custom Image</strong></em><em>), network settings, metadata (including</em> <em><strong>Startup Scripts</strong></em><em>), and IAM service accounts.</em></li>
<li><strong>Key Benefits:</strong><ul>
<li><em><strong>Reusability:</strong></em> <em>Instead of manually configuring dozens of flags every time you create a VM, you define it once in a template.</em></li>
<li><em><strong>Auto-scaling:</strong></em> <em>Instance templates are required for Managed Instance Groups (MIGs) to add or remove identical instances based on traffic load automatically.</em></li>
</ul>
</li>
</ul>
<p><em>Here is the step-by-step guide to creating one:</em></p>
<h3><em>Step 1: Navigate to Instance Templates</em></h3>
<ol>
<li><em>In the Google Cloud Console search bar at the top, type</em> <em><strong>Instance templates</strong></em> <em>and select it under</em> <em><strong>Compute Engine</strong></em><em>.</em></li>
<li><em>At the top of the page, click</em> <em><strong>+ Create instance template</strong></em><em>.</em></li>
</ol>
<img src="https://cdn.hashnode.com/uploads/covers/668a9cde782d9687087baab0/eb7fe128-6f48-49df-8a29-7781a0d69653.png" alt="" style="display:block;margin:0 auto" />

<h3><em>Step 2: Configure the Template Settings</em></h3>
<p><em>An instance template looks almost identical to the normal VM creation page. Fill out the configuration you want your future VMs to use:</em></p>
<ul>
<li><em><strong>Name:</strong></em> <em>Give your template a lowercase, hyphen-separated name (e.g.,</em> <code>my-web-server-template</code><em>).</em></li>
<li><em><strong>Machine configuration:</strong></em> <em>Choose your series, machine type (e.g.,</em> <code>e2-medium</code><em>), and memory.</em></li>
<li><em><strong>Boot disk:</strong></em> <em>Click</em> <em><strong>Change</strong></em> <em>if you want to swap out the default OS. This is where you can select your</em> <em><strong>Custom Image</strong></em> <em>from the dropdown menu instead of a public image.</em></li>
<li><em><strong>Firewall:</strong></em> <em>(Optional) Check the boxes to allow HTTP/HTTPS traffic if this is a web server.</em></li>
</ul>
<img src="https://cdn.hashnode.com/uploads/covers/668a9cde782d9687087baab0/bbf4426e-93ed-4a7c-9195-93f294445f55.png" alt="" style="display:block;margin:0 auto" />

<h3><em>Step 3: Add Your Startup Script (Bootstrapping)</em></h3>
<ol>
<li><em>Scroll down and click on</em> <em><strong>Management, security, disks, networking, sole tenancy</strong></em> <em>to expand it.</em></li>
<li><em>Click on the</em> <em><strong>Management</strong></em> <em>tab.</em></li>
<li><em>Scroll down to the</em> <em><strong>Automation</strong></em> <em>section.</em></li>
<li><em>Paste your script directly into the</em> <em><strong>Startup script</strong></em> <em>text box (or provide your Cloud Storage URL in the metadata section if preferred).</em></li>
</ol>
<img src="https://cdn.hashnode.com/uploads/covers/668a9cde782d9687087baab0/930930ae-79d4-400a-a5e2-109c13e0f552.png" alt="" style="display:block;margin:0 auto" />

<p><em>Create a Single VM Instance from a Template and click on create.</em></p>
<img src="https://cdn.hashnode.com/uploads/covers/668a9cde782d9687087baab0/9cf27c33-84fb-4af5-bb79-0c963ab49b41.png" alt="" style="display:block;margin:0 auto" />

<img src="https://cdn.hashnode.com/uploads/covers/668a9cde782d9687087baab0/54ea02fe-241a-4494-b69d-14c988bb3854.png" alt="" style="display:block;margin:0 auto" />

<p><em>VM is ready.</em></p>
<img src="https://cdn.hashnode.com/uploads/covers/668a9cde782d9687087baab0/883c70e3-4988-460f-8d7a-a4ba26e508f9.png" alt="" style="display:block;margin:0 auto" />

<p><em>The automated script is also working!!</em></p>
<img src="https://cdn.hashnode.com/uploads/covers/668a9cde782d9687087baab0/dc5d4790-e881-4d4a-8839-588653298b98.png" alt="" style="display:block;margin:0 auto" />

<p><em>Once you have created an</em> <em><strong>Instance Template</strong></em><em>, you can use it to quickly spin up individual virtual machines or automate scaling for your applications.</em></p>
]]></content:encoded></item><item><title><![CDATA[IP Address - External, Internal, and Static]]></title><description><![CDATA[Many Google Cloud resources can have internal IP addresses and external IP addresses. For example, you can assign an internal and an external IP address to…]]></description><link>https://terraform-project-spotify-playlist.hashnode.dev/ip-address-external-internal-and-static</link><guid isPermaLink="true">https://terraform-project-spotify-playlist.hashnode.dev/ip-address-external-internal-and-static</guid><dc:creator><![CDATA[Vibhuti Jain]]></dc:creator><pubDate>Thu, 29 Oct 2026 19:20:27 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/668a9cde782d9687087baab0/e1bbf21a-a41a-4556-9b0f-d117c871e293.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><em>Many Google Cloud resources can have internal IP addresses and external IP addresses. For example, you can assign an internal and an external IP address to Compute Engine instances. The instances use these addresses to communicate with other Google Cloud resources and external systems.</em></p>
<table>
<thead>
<tr>
<th>Type</th>
<th>Behavior</th>
</tr>
</thead>
<tbody><tr>
<td><strong>Internal IP</strong></td>
<td><em>Private address inside your Google Cloud network (VPC). It stays the same for the VM’s life and is free.</em></td>
</tr>
<tr>
<td><strong>External ephemeral IP</strong></td>
<td><em>Public, reachable from the internet, but temporary. It may change when you stop or restart the VM.</em></td>
</tr>
<tr>
<td><strong>External static IP</strong></td>
<td><em>Public and permanent. You reserve it. If you reserve one and don’t attach it to anything, you are charged more.</em></td>
</tr>
</tbody></table>
<p><strong>Hands-on: On IP Address</strong></p>
<p><em>Set Up a VM with an Ephemeral IP</em></p>
<p><em><strong>Goal:</strong></em> <em>Show how a standard dynamic IP address changes when a VM is stopped and restarted.</em></p>
<ol>
<li><em>Go to the</em> <em><strong>GCP Console</strong></em> <em>and navigate to</em> <em><strong>Compute Engine</strong></em> <em>&gt;</em> <em><strong>VM instances</strong></em><em>.</em></li>
<li><em>Click</em> <em><strong>Create Instance</strong></em><em>.</em></li>
<li><em>Keep the default settings (e.g.,</em> <code>e2-medium</code><em>, Debian/Ubuntu OS).</em></li>
</ol>
<img src="https://cdn.hashnode.com/uploads/covers/668a9cde782d9687087baab0/58651f8a-c358-45f4-8f5a-06c47670b181.png" alt="" style="display:block;margin:0 auto" />

<img src="https://cdn.hashnode.com/uploads/covers/668a9cde782d9687087baab0/f60a57e8-9a1c-40df-84a4-ff093ae514d0.png" alt="" style="display:block;margin:0 auto" />

<img src="https://cdn.hashnode.com/uploads/covers/668a9cde782d9687087baab0/31fda979-098b-4433-a0e2-10798e6ced0a.png" alt="" style="display:block;margin:0 auto" />

<ol start="4">
<li>Expand <strong>Networking</strong> &gt; click on the default <strong>Network interface</strong></li>
</ol>
<img src="https://cdn.hashnode.com/uploads/covers/668a9cde782d9687087baab0/4c40992f-54a7-4f96-b18a-d256bacabf70.png" alt="" style="display:block;margin:0 auto" />

<ol start="5">
<li>Under <strong>External IPv4 address</strong>, ensure <strong>Ephemeral</strong> is selected.</li>
</ol>
<img src="https://cdn.hashnode.com/uploads/covers/668a9cde782d9687087baab0/b1988065-7031-4b55-8305-806012267068.png" alt="" style="display:block;margin:0 auto" />

<img src="https://cdn.hashnode.com/uploads/covers/668a9cde782d9687087baab0/4ac2b068-a3e9-4108-a3cc-1befd023b1b0.png" alt="" style="display:block;margin:0 auto" />

<p><em>Note down the</em> <em><strong>External IP</strong></em> <em>address listed next to your new VM:</em></p>
<table style="min-width:100px"><colgroup><col style="min-width:25px"></col><col style="min-width:25px"></col><col style="min-width:25px"></col><col style="min-width:25px"></col></colgroup><tbody><tr><td align="left" style="text-align:left"><p><a target="_blank" rel="noopener noreferrer" class="cursor-pointer cfc-external-link ng-star-inserted" href="https://136.114.228.233/" style="pointer-events:none"><u>136.114.228.233</u> </a>(<a target="_self" rel="noopener" class="cursor-pointer ng-star-inserted" href="https://console.cloud.google.com/networking/networkinterfaces/zones/us-central1-a/instances/ip-demo-vm?networkInterface=nic0&amp;project=project-aae2bcba-2b97-4003-a23&amp;authuser=4" style="pointer-events:none">nic0</a>)</p></td><td align="left" style="text-align:left"><p></p></td><td align="left" style="text-align:left"><p></p></td><td align="left" style="text-align:left"><p></p></td></tr></tbody></table>

<ol start="6">
<li><em>Click the</em> <em><strong>SSH</strong></em> <em>button next to the VM to connect to it.</em></li>
<li>Inside the terminal, run <code>curl</code> <a href="http://ifconfig.me"><code>ifconfig.me</code></a> to verify that the VM sees the same external IP.</li>
</ol>
<img src="https://cdn.hashnode.com/uploads/covers/668a9cde782d9687087baab0/db93357e-5bdd-4699-bc82-d3a8ce247cef.png" alt="" style="display:block;margin:0 auto" />

<ol start="8">
<li><em>Go back to the GCP Console, select the VM, and click</em> <em><strong>Stop</strong></em><em>. Wait a minute, then click</em> <em><strong>Start</strong></em><em>.</em></li>
</ol>
<img src="https://cdn.hashnode.com/uploads/covers/668a9cde782d9687087baab0/38e3c1e4-6d85-40a9-8a1b-6b2d3f9a87a5.png" alt="" style="display:block;margin:0 auto" />

<img src="https://cdn.hashnode.com/uploads/covers/668a9cde782d9687087baab0/6f9a20bf-a0dc-44f8-b4f6-20064462cf42.png" alt="" style="display:block;margin:0 auto" />

<ul>
<li><strong>O<em>bserve:</em></strong> <em>The VM now has a</em> <em><strong>completely different External IP address</strong></em><em>. Explain to your audience that ephemeral IPs are released back into Google's pool when a resource is stopped.</em></li>
</ul>
<img src="https://cdn.hashnode.com/uploads/covers/668a9cde782d9687087baab0/6f9a20bf-a0dc-44f8-b4f6-20064462cf42.png" alt="" style="display:block;margin:0 auto" />

<p><em>Start it again, and you will see the external IP again.</em></p>
<img src="https://cdn.hashnode.com/uploads/covers/668a9cde782d9687087baab0/6b86297b-7380-432a-a2ca-d47c986fe9e2.png" alt="" style="display:block;margin:0 auto" />

<img src="https://cdn.hashnode.com/uploads/covers/668a9cde782d9687087baab0/2757c6c2-bc2e-42ae-a12f-08755c5e66e8.png" alt="" style="display:block;margin:0 auto" />

<h3><em>Promote to a Static External IP</em></h3>
<p><em><strong>Goal:</strong></em> <em>Show how to lock down an IP address so it survives restarts.</em></p>
<ol>
<li><em>In the GCP Console search bar, search for</em> <em><strong>VPC network</strong></em> <em>and select</em> <em><strong>IP addresses</strong></em><em>.</em></li>
</ol>
<img src="https://cdn.hashnode.com/uploads/covers/668a9cde782d9687087baab0/212d6e0a-2f27-406e-8e0f-2557c864581f.png" alt="" style="display:block;margin:0 auto" />

<ol start="2">
<li><em>You will see the current ephemeral IP assigned to your running VM.</em></li>
</ol>
<img src="https://cdn.hashnode.com/uploads/covers/668a9cde782d9687087baab0/49357fbf-d36e-4adb-98b0-56e3b937ba77.png" alt="" style="display:block;margin:0 auto" />

<ol start="3">
<li><em>Click the three dots (More actions) next to your VM's IP address and select</em> <em><strong>Promote to static IP address</strong></em></li>
</ol>
<img src="https://cdn.hashnode.com/uploads/covers/668a9cde782d9687087baab0/0cbbb9e2-b673-4aab-9748-cee8c2c2829a.png" alt="" style="display:block;margin:0 auto" />

<ol start="4">
<li><em>Give it a name (e.g.,</em> <code>demo-static-ip</code><em>) and click</em> <em><strong>Reserve</strong></em><em>.</em></li>
</ol>
<ul>
<li>Go back to <strong>Compute Engine</strong> &gt; <strong>VM instances</strong>.</li>
<li>Select your VM and click <strong>Stop</strong>.</li>
<li>Once stopped, click <strong>Start</strong>.</li>
<li><strong>Observe:</strong> The External IP address <strong>remains the same</strong>: 136.114.228.233</li>
</ul>
<img src="https://cdn.hashnode.com/uploads/covers/668a9cde782d9687087baab0/ab9591ad-d916-489f-8692-00a20c2ba51f.png" alt="" style="display:block;margin:0 auto" />

<h3>Clean Up (Important)</h3>
<p><em>Goal: Prevent unnecessary cloud costs. GCP charges for static external IP addresses that are reserved but not attached to a running resource.</em></p>
<ol>
<li>Delete the VM instance.</li>
<li>Go back to VPC network &gt; IP addresses.</li>
<li>Select your static IP (which should now show as "In use by: None").</li>
<li>Click Release Static IP.</li>
</ol>
<img src="https://cdn.hashnode.com/uploads/covers/668a9cde782d9687087baab0/4b814476-0556-469a-938a-86366edbad6f.png" alt="" style="display:block;margin:0 auto" />

<img src="https://cdn.hashnode.com/uploads/covers/668a9cde782d9687087baab0/09fb2db4-e43d-4673-9255-bcce10eec506.png" alt="" style="display:block;margin:0 auto" />

<p>Takeaway: e<em>phemeral IP addresses change whenever a GCP resource stops and restarts, while static IP addresses remain permanently locked to your project until you manually delete them.</em></p>
<ul>
<li><em><strong>Ephemeral IPs:</strong></em> <em>Free while the VM is running, but they are released back into Google's pool when the VM stops.</em></li>
<li><em><strong>Static IPs:</strong></em> <em>Reserved exclusively for you. They survive restarts and deletions, but GCP charges a small fee if they sit idle.</em></li>
</ul>
]]></content:encoded></item><item><title><![CDATA[GCP Compute Engine]]></title><description><![CDATA[Machine Family vs. Machine Type and VM creation Hands-on]]></description><link>https://terraform-project-spotify-playlist.hashnode.dev/gcp-compute-engine</link><guid isPermaLink="true">https://terraform-project-spotify-playlist.hashnode.dev/gcp-compute-engine</guid><dc:creator><![CDATA[Vibhuti Jain]]></dc:creator><pubDate>Wed, 28 Oct 2026 18:58:07 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/668a9cde782d9687087baab0/84db926e-c9bf-4d42-83e3-475da3306069.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h3><em>What is a GCE virtual machine?</em></h3>
<p><em>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.</em></p>
<p><em>A VM has resources such as:</em></p>
<p><em>CPU: How much processing work it can do.<br />Memory (RAM): How much data and how many programs it can handle at once.<br />Disk: Where the operating system, files, and applications are stored.<br />Network: How it communicates with other systems and the internet.</em></p>
<p><em>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.</em></p>
<h4><em>Key building blocks</em></h4>
<table>
<thead>
<tr>
<th><em>Concept</em></th>
<th><em>Meaning</em></th>
</tr>
</thead>
<tbody><tr>
<td><em>Instance</em></td>
<td><em>The VM itself</em></td>
</tr>
<tr>
<td><em>Image</em></td>
<td><em>The OS and software the VM starts with</em></td>
</tr>
<tr>
<td><em>Machine family</em></td>
<td><em>The category of hardware</em></td>
</tr>
<tr>
<td><em>Machine type</em></td>
<td><em>The exact CPU and memory size</em></td>
</tr>
<tr>
<td><em>Hyperdisk / Persistent Disk</em></td>
<td><em>Virtual hard disks (block storage) attached to the VM</em></td>
</tr>
</tbody></table>
<h3><strong>What is a machine family?</strong></h3>
<p><em>A machine family is a category of VMs designed for a particular kind of workload.</em></p>
<p><em><strong>Analogy:</strong></em> <em>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.</em></p>
<p><em>GCP machine families work similarly.</em></p>
<table>
<thead>
<tr>
<th>Family</th>
<th>Letters</th>
<th>Best for</th>
</tr>
</thead>
<tbody><tr>
<td>General purpose</td>
<td>E2, N2, C3, N4</td>
<td><em>For everyday applications, small servers, web applications, development, and testing.</em></td>
</tr>
<tr>
<td>Memory optimized</td>
<td>M3, M4, X</td>
<td><em>For applications that need very large amounts of RAM, such as large in-memory databases.</em></td>
</tr>
<tr>
<td>Compute optimized</td>
<td>C3, H</td>
<td><em>For CPU-intensive work such as scientific calculations, high-performance web services, and intensive data processing.</em></td>
</tr>
<tr>
<td>Storage optimized</td>
<td>Z</td>
<td><em>Big data and data warehouses (fast disk I/O)</em></td>
</tr>
<tr>
<td>Accelerator optimized</td>
<td>A, G</td>
<td><em>For demanding GPU workloads such as AI training and high-performance computing.</em></td>
</tr>
</tbody></table>
<p><em>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.</em></p>
<h3><strong>What is a machine type?</strong></h3>
<p><em>A machine type tells you the actual CPU and RAM resources your VM will receive.</em></p>
<p><em>For example, imagine you choose the E2 machine series. You can select a smaller or larger machine type depending on your workload.</em></p>
<p>Here is an example using E2 machine types:</p>
<table>
<thead>
<tr>
<th>Machine type</th>
<th>vCPUs</th>
<th>Memory (RAM)</th>
</tr>
</thead>
<tbody><tr>
<td><code>e2-small</code></td>
<td>Shared-core</td>
<td>2 GB</td>
</tr>
<tr>
<td><code>e2-medium</code></td>
<td>Shared-core</td>
<td>4 GB</td>
</tr>
<tr>
<td><code>e2-standard-2</code></td>
<td>2</td>
<td>8 GB</td>
</tr>
<tr>
<td><code>e2-standard-4</code></td>
<td>4</td>
<td>16 GB</td>
</tr>
</tbody></table>
<p><em>Let's break down one example: e2-standard-2 --&gt; 2 vCPUs, 8 GB RAM</em><br /><em>e2 = the machine series.</em><br /><em>standard = a balanced CPU-to-memory configuration.</em><br /><em>2 = two vCPUs.</em></p>
<p><em>This is a general-purpose VM configuration suitable for many small applications and learning exercises.</em></p>
<h3>Hands-on: How to choose a machine family and type in GCP and create VMs.</h3>
<p><em>Step 1 — Open Compute Engine</em></p>
<p><em>Go to the</em> <a href="https://console.cloud.google.com/?utm_source=chatgpt.com"><em>Google Cloud Console</em></a><em>, select your project, then navigate to Compute Engine → VM instances → Create instance.</em></p>
<img src="https://cdn.hashnode.com/uploads/covers/668a9cde782d9687087baab0/45d77673-4a24-47a0-bd54-a80c5a257eff.png" alt="" style="display:block;margin:0 auto" />

<img src="https://cdn.hashnode.com/uploads/covers/668a9cde782d9687087baab0/27d10c93-b9e1-425e-81a9-386b1547c157.png" alt="" style="display:block;margin:0 auto" />

<p>Step 2 — Select a machine configuration</p>
<p><em>Find the Machine configuration section. Depending on the current console layout, you'll see options for the machine family, series, and machine type.</em></p>
<img src="https://cdn.hashnode.com/uploads/covers/668a9cde782d9687087baab0/8ecb93d9-3d86-4c62-9861-6b46d158f52a.png" alt="" style="display:block;margin:0 auto" />

<p><em>Step 3 — Choose a family and type</em></p>
<p><em>For a basic learning VM, select General-purpose → E2, then choose an appropriately small machine type available to your project and zone.</em></p>
<img src="https://cdn.hashnode.com/uploads/covers/668a9cde782d9687087baab0/7b4bee74-9c96-43b2-a31a-b8fd09427403.png" alt="" style="display:block;margin:0 auto" />

<p><em>Step 4 — Choose OS and storage</em></p>
<p>*An image decides what OS and software your VM runs.<br />*<em><strong>Public images</strong></em> <em>are ready-made (Debian, Ubuntu, Windows Server, SQL Server).</em></p>
<img src="https://cdn.hashnode.com/uploads/covers/668a9cde782d9687087baab0/8c6bfafe-5dc4-4d14-8261-653452fd45d5.png" alt="" style="display:block;margin:0 auto" />

<p><em>Step 5 — Choose networking for communication.</em></p>
<img src="https://cdn.hashnode.com/uploads/covers/668a9cde782d9687087baab0/ce3bcdb3-b9f5-4ed2-894b-fa71e791c89b.png" alt="" style="display:block;margin:0 auto" />

<p><em>Step 6 — Review and create</em></p>
<img src="https://cdn.hashnode.com/uploads/covers/668a9cde782d9687087baab0/35e66338-3c01-4140-bc8a-b900a5e198ea.png" alt="" style="display:block;margin:0 auto" />

<p><em>Hands-on: HTTP server</em></p>
<p><em>Connect to the VM via SSH</em></p>
<img src="https://cdn.hashnode.com/uploads/covers/668a9cde782d9687087baab0/484265da-0c5e-4128-a7d5-dfba464208d9.png" alt="" style="display:block;margin:0 auto" />

<p><em>Task: Install Apache Server on VM</em></p>
<img src="https://cdn.hashnode.com/uploads/covers/668a9cde782d9687087baab0/dadea0b4-9848-49c6-907b-833193b73f8f.png" alt="" style="display:block;margin:0 auto" />

<img src="https://cdn.hashnode.com/uploads/covers/668a9cde782d9687087baab0/afef683b-01cc-400f-a523-7feec9a6fb1e.png" alt="" style="display:block;margin:0 auto" />

<img src="https://cdn.hashnode.com/uploads/covers/668a9cde782d9687087baab0/afef683b-01cc-400f-a523-7feec9a6fb1e.png" alt="" style="display:block;margin:0 auto" />

<img src="https://cdn.hashnode.com/uploads/covers/668a9cde782d9687087baab0/5eb0a356-755d-4e5f-866c-aa7d597a71d6.png" alt="" style="display:block;margin:0 auto" />

<h3><em>Your takeaway</em></h3>
<p><em>Remember this simple rule: Choose the family based on the workload, then choose the machine type based on the resources you need.</em></p>
]]></content:encoded></item></channel></rss>