Calculadora Google Cloud

Google Cloud Compute Engine Cost Calculator

Estimate your monthly Google Cloud Compute Engine costs based on your instance configuration, region, and usage.

Linux (Free) Windows Server
us-central1 (Iowa) europe-west1 (Belgium) asia-east1 (Taiwan)
None 1-Year CUD (approx. 25% off compute) 3-Year CUD (approx. 45% off compute)

Persistent Disk Storage

Network Egress (Internet)

function calculateGCPCost() { // Get input values var numInstances = parseFloat(document.getElementById('numInstances').value); var vCPUs = parseFloat(document.getElementById('vCPUs').value); var ramGB = parseFloat(document.getElementById('ramGB').value); var operatingSystem = document.getElementById('operatingSystem').value; var region = document.getElementById('region').value; var usageHours = parseFloat(document.getElementById('usageHours').value); var cudDiscount = document.getElementById('cudDiscount').value; var standardDiskGB = parseFloat(document.getElementById('standardDiskGB').value); var ssdDiskGB = parseFloat(document.getElementById('ssdDiskGB').value); var networkEgressGB = parseFloat(document.getElementById('networkEgressGB').value); // Validate inputs if (isNaN(numInstances) || numInstances <= 0 || isNaN(vCPUs) || vCPUs <= 0 || isNaN(ramGB) || ramGB <= 0 || isNaN(usageHours) || usageHours <= 0 || isNaN(standardDiskGB) || standardDiskGB < 0 || isNaN(ssdDiskGB) || ssdDiskGB < 0 || isNaN(networkEgressGB) || networkEgressGB < 0) { document.getElementById('result').innerHTML = 'Please enter valid positive numbers for all fields (disk/network can be zero).'; return; } // Define pricing based on region (simplified for this calculator, actual prices vary) var vCpuHourlyRate = 0; var ramHourlyRate = 0; var windowsVcpuHourlyAddon = 0; var standardDiskMonthlyRate = 0; var ssdDiskMonthlyRate = 0; var networkEgressGbRate = 0; switch (region) { case 'us-central1': // Iowa vCpuHourlyRate = 0.033; ramHourlyRate = 0.0045; windowsVcpuHourlyAddon = 0.04; // Per vCPU standardDiskMonthlyRate = 0.04; // Per GB ssdDiskMonthlyRate = 0.17; // Per GB networkEgressGbRate = 0.12; // Per GB break; case 'europe-west1': // Belgium vCpuHourlyRate = 0.036; ramHourlyRate = 0.005; windowsVcpuHourlyAddon = 0.04; standardDiskMonthlyRate = 0.045; ssdDiskMonthlyRate = 0.19; networkEgressGbRate = 0.13; break; case 'asia-east1': // Taiwan vCpuHourlyRate = 0.04; ramHourlyRate = 0.0055; windowsVcpuHourlyAddon = 0.04; standardDiskMonthlyRate = 0.05; ssdDiskMonthlyRate = 0.21; networkEgressGbRate = 0.14; break; default: // Default to us-central1 if somehow an invalid region is selected vCpuHourlyRate = 0.033; ramHourlyRate = 0.0045; windowsVcpuHourlyAddon = 0.04; standardDiskMonthlyRate = 0.04; ssdDiskMonthlyRate = 0.17; networkEgressGbRate = 0.12; break; } // Calculate VM Compute Cost per instance var baseVcpuCostPerInstance = vCPUs * vCpuHourlyRate * usageHours; var baseRamCostPerInstance = ramGB * ramHourlyRate * usageHours; var totalBaseComputeCostPerInstance = baseVcpuCostPerInstance + baseRamCostPerInstance; // Apply OS cost per instance var osCostPerInstance = 0; if (operatingSystem === 'windows') { osCostPerInstance = vCPUs * windowsVcpuHourlyAddon * usageHours; } // Apply CUD to base compute (vCPU + RAM), not OS license var cudFactor = 1; var cudDescription = "None"; if (cudDiscount === '1year') { cudFactor = 0.75; // 25% discount cudDescription = "1-Year CUD (approx. 25% off compute)"; } else if (cudDiscount === '3year') { cudFactor = 0.55; // 45% discount cudDescription = "3-Year CUD (approx. 45% off compute)"; } var finalComputeCost = (totalBaseComputeCostPerInstance * cudFactor + osCostPerInstance) * numInstances; // Calculate Storage Cost (monthly) per instance, then multiply by number of instances var standardDiskCostPerInstance = standardDiskGB * standardDiskMonthlyRate; var ssdDiskCostPerInstance = ssdDiskGB * ssdDiskMonthlyRate; var totalStorageCost = (standardDiskCostPerInstance + ssdDiskCostPerInstance) * numInstances; // Calculate Network Egress Cost (monthly total) var totalNetworkEgressCost = networkEgressGB * networkEgressGbRate; // Total Monthly Cost var totalMonthlyCost = finalComputeCost + totalStorageCost + totalNetworkEgressCost; // Display results var resultHtml = '

Estimated Monthly Google Cloud Cost

'; resultHtml += 'Total Estimated Cost: $' + totalMonthlyCost.toFixed(2) + "; resultHtml += '

Cost Breakdown:

'; resultHtml += 'Compute Engine Instances: $' + finalComputeCost.toFixed(2) + "; resultHtml += '
    '; resultHtml += '
  • Number of Instances: ' + numInstances + '
  • '; resultHtml += '
  • vCPUs per Instance: ' + vCPUs + '
  • '; resultHtml += '
  • RAM per Instance: ' + ramGB + ' GB
  • '; resultHtml += '
  • Operating System: ' + (operatingSystem === 'linux' ? 'Linux' : 'Windows Server') + '
  • '; resultHtml += '
  • Region: ' + region + '
  • '; resultHtml += '
  • Usage: ' + usageHours + ' hours/month
  • '; resultHtml += '
  • Committed Use Discount: ' + cudDescription + '
  • '; resultHtml += '
'; resultHtml += 'Persistent Disk Storage: $' + totalStorageCost.toFixed(2) + "; resultHtml += '
    '; resultHtml += '
  • Standard Persistent Disk: ' + standardDiskGB + ' GB per instance
  • '; resultHtml += '
  • SSD Persistent Disk: ' + ssdDiskGB + ' GB per instance
  • '; resultHtml += '
'; resultHtml += 'Network Egress (Internet): $' + totalNetworkEgressCost.toFixed(2) + "; resultHtml += '
    '; resultHtml += '
  • Estimated Egress: ' + networkEgressGB + ' GB/month
  • '; resultHtml += '
'; document.getElementById('result').innerHTML = resultHtml; } .calculator-container { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; background-color: #f9f9f9; padding: 25px; border-radius: 8px; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); max-width: 700px; margin: 20px auto; border: 1px solid #e0e0e0; } .calculator-container h2 { color: #1a73e8; text-align: center; margin-bottom: 20px; font-size: 26px; } .calculator-container h3 { color: #333; margin-top: 25px; margin-bottom: 15px; font-size: 20px; border-bottom: 1px solid #eee; padding-bottom: 5px; } .calculator-container p { color: #555; line-height: 1.6; margin-bottom: 10px; } .calc-input-group { margin-bottom: 15px; display: flex; flex-direction: column; } .calc-input-group label { margin-bottom: 7px; color: #333; font-weight: bold; font-size: 15px; } .calc-input-group input[type="number"], .calc-input-group select { padding: 10px; border: 1px solid #ccc; border-radius: 5px; font-size: 15px; width: 100%; box-sizing: border-box; } .calc-input-group input[type="number"]:focus, .calc-input-group select:focus { border-color: #1a73e8; outline: none; box-shadow: 0 0 5px rgba(26, 115, 232, 0.3); } .calculator-container button { background-color: #1a73e8; color: white; padding: 12px 25px; border: none; border-radius: 5px; font-size: 18px; cursor: pointer; display: block; width: 100%; margin-top: 25px; transition: background-color 0.3s ease; } .calculator-container button:hover { background-color: #155ac9; } .calculator-result { margin-top: 30px; padding: 20px; background-color: #e8f0fe; border: 1px solid #a8c7fa; border-radius: 8px; color: #202124; } .calculator-result h3 { color: #1a73e8; margin-top: 0; font-size: 22px; border-bottom: none; padding-bottom: 0; } .calculator-result h4 { color: #333; margin-top: 15px; font-size: 18px; } .calculator-result p { font-size: 16px; margin-bottom: 8px; } .calculator-result strong { color: #000; } .calculator-result ul { list-style-type: disc; margin-left: 20px; padding-left: 0; margin-top: 5px; margin-bottom: 10px; } .calculator-result ul li { margin-bottom: 3px; color: #444; }

Understanding Google Cloud Compute Engine Pricing

Google Cloud Platform (GCP) offers a robust suite of cloud computing services, with Compute Engine being one of its core offerings. Compute Engine allows you to run virtual machines (VMs) on Google's infrastructure. Understanding its pricing model is crucial for managing your cloud budget effectively.

Key Factors Influencing Compute Engine Costs

Several factors contribute to the overall cost of running VMs on Google Compute Engine:

1. Machine Type (vCPUs and RAM)

The most significant cost driver is the machine type you choose, which defines the number of virtual CPUs (vCPUs) and the amount of memory (RAM) allocated to your instance. Google offers various machine families (e.g., E2, N2, N1, C2, M1) optimized for different workloads. Generally, more vCPUs and RAM mean higher costs.

2. Operating System

While Linux-based operating systems (like Debian, Ubuntu, CentOS) are typically free, using Windows Server incurs additional licensing costs, which are usually charged per vCPU-hour.

3. Region and Zone

Google Cloud's global infrastructure is divided into regions and zones. Pricing for compute resources can vary significantly between different regions due to local market conditions, energy costs, and infrastructure expenses. Choosing a region closer to your users can reduce latency but might come with different price tags.

4. Usage Duration

Compute Engine instances are billed per second, with a 1-minute minimum. The longer your instances run, the higher your costs. For instances that run 24/7, you'll accrue charges for approximately 730 hours per month.

5. Committed Use Discounts (CUDs)

Google Cloud offers substantial discounts if you commit to using a certain amount of compute resources for a 1-year or 3-year period. These Committed Use Discounts (CUDs) can reduce your compute costs by 20-30% for 1-year commitments and 40-50% for 3-year commitments, making them highly beneficial for stable, long-term workloads. Note that CUDs typically apply to the base compute (vCPU and RAM) and not to OS licenses or other services.

6. Persistent Disk Storage

VMs require persistent disk storage for their operating system and data. Google Cloud offers different types of persistent disks:

  • Standard Persistent Disk (HDD): Cost-effective for large, sequential reads/writes, suitable for boot disks and less I/O-intensive applications.
  • SSD Persistent Disk: Higher performance and higher cost, ideal for databases and applications requiring high IOPS.

Storage is typically billed per GB per month, regardless of whether the VM is running.

7. Network Egress

While ingress (data coming into Google Cloud) is generally free, egress (data leaving Google Cloud) incurs charges. This includes data transferred from your VMs to the internet, to other regions, or even between different zones within the same region (though inter-zone egress is usually cheaper than internet egress). The calculator focuses on internet egress, which is a common cost factor.

How to Optimize Your Google Cloud Costs

  • Right-size your VMs: Don't over-provision resources. Monitor your VM usage and adjust machine types to match actual needs.
  • Utilize CUDs: For predictable workloads, commit to 1-year or 3-year CUDs to significantly reduce compute costs.
  • Choose the right region: Balance latency requirements with cost considerations.
  • Automate instance management: Use features like instance groups, auto-scaling, and scheduled shutdowns for non-production environments to only pay for what you use.
  • Monitor network egress: Keep an eye on data transfer out of GCP, especially to the internet, as it can become a significant cost.
  • Select appropriate storage: Use Standard Persistent Disks for less critical data and SSDs only where high performance is truly needed.

This calculator provides an estimate based on common pricing models. For precise and up-to-date pricing, always refer to the official Google Cloud pricing pages and use the Google Cloud Pricing Calculator.

Leave a Reply

Your email address will not be published. Required fields are marked *