Cost planning is an important phase in your design that starts with capacity planning. I recommend that you treat capacity planning not as a one-off task, but as a continuous iterative cycle as illustrated on this slide. Start with a forecast that estimates the capacity needed. Monitor and review this forecast, then allocate by determining the resources required to meet the forecasted capacity. This allows you to estimate costs and balance them against risks and rewards. Once the design and cost is approved, deploy your design and monitor it to see how accurate your forecasts were. This feeds into the next forecast as the process repeats. A good starting point for anybody working on cost optimization is to become familiar with the VM instance pricing. It is often beneficial to start with a couple of small machines that can scale out through auto-scaling as demand grows. To optimize the cost of your virtual machines, consider using committed use discounts as these can be significant. Also, if your workloads allow for preemptible instances, you can save up to 80 percent and use auto healing to recover when instances are preempted. Compute Engine also provides sizing recommendations for your VM instances, as shown on the right. This is a really useful feature that can help you select the right size of VM for your workloads and optimize costs. A common mistake is to over-allocate disk space. This is not cost efficient, but selecting a disk is not just about size, it is important to determine the performance characteristics your applications display. The IO patterns, do you have large reads, small writes, vice versa, mainly read-only data. This type of information will help you select the correct type of disk. As the table shows, SSD persistent disks are significantly more expensive than standard persistent disks. Understanding your IO patterns can help provide significant savings. To optimize network costs, it is best practice to keep machines as close as possible to the data they need to access. This graphic shows the different types of egress within the same zone, between zones in the same region, intercontinental egress and Internet egress. It is also important to be aware of egress charges. These are not all straightforward. Egress in the same zone is free. Egress to different Cloud service within the same region using an external IP address or an internal IP address is free, except for some services such as memory store for Redis. Egress between zones in the same region is charged and all Internet egress is charged. One way to optimize your network costs, is to keep your machines close to your data. Another way to optimize cost is to leverage GKE usage metering, which can prevent over-provisioning your Kubernetes cluster. With GKE usage metering, an agent collects consumption metrics in addition to the resource requests by polling part metric objects from the metric server. The resource requests record and resource consumption records are exported to two separate tables in BigQuery datasets that you specify. Comparing requested with consumed resources makes it easy to spot waste and to take corrective measures. This graphic shows a typical configuration where BigQuery is used for requests-based metrics collected from the usage metering agent, and together with data obtained from Billing Export, it is analyzed in a Data Studio dashboard. Earlier in the course, we talked about all of the different storage services. It's important to compare the costs of the different options as well as their characteristics. For example, as of this recording, Firestore provides one gigabyte of storage for free under the free access tier. If you store the same amount of data in Cloud Bigtable, you could pay over $1,000 per month, because you'd need at least three Bigtable nodes. In other words, your storage and database services choice can make a significant difference to your bill. Your architectural design can also help you optimize your costs. For example, if you use Cloud CDN for static content or memory store as a cache you can save instead of allocating more resources. Similarly, instead of using a data store between two applications, considering messaging and queuing with pops up to decouple communicating services and reduce storage needs. The pricing calculator should be your go-to resource for estimating costs. Your estimates should be based on your forecasting and capacity planning. The tool is great for comparing costs of different compute and storage services, and you will use it in the upcoming design activity. To monitor the cost of your existing service, leverage the Cloud Billing Reports page as shown here. This report shows the changes in costs compared to the previous month, and you can use the filters to search for particular projects, products, and regions as shown on the right. The sizing recommendations for your Compute Engine instances will also be in this report. For advanced cost analysis, I recommend exporting your billing data to BigQuery, as shown in the screenshot. You can then analyze the billing data to identify large expenses and optimize your Google Cloud spend. For example, let's assume you label VM instances that are spread across different regions. Maybe these instances are sending most of their traffic to a different continent, which could incur higher costs. In that case, you might want to consider relocating some of those instances or using a caching service like Cloud CDN to cache content closer to your users, which reduces your networking spend. You can even visualize spend over time with Google Data Studio, which turns your data into informative dashboards and reports that are easy to read, easy to share, and fully customizable. The surface data is displayed in a daily and monthly view providing at-a-glance summaries that can also be drilled down in to provide greater insights. To help with project planning and controlling costs, you can set a budget. Setting a budget lets you track how your spend is growing toward that amount. This screenshot shows the budget creation interface. First, set a budget name and specify which project this budget applies to. Then set the budget at a specific amount or match it to the previous month spend. Last, set the budget alerts. These alerts send emails to billing admins after spend exceeds a percent of a budget or a specified amount. In our case, it would send an email when spending reaches 50, 90 and 100 percent of the budget amount. You can even choose to send an alert when the spend is forecasted to exceed the percent of the budget amount by the end of the budget period. In addition to receiving an email, you can use Pub/Sub notifications to programmatically receive spend updates about this budget. You could even create a Cloud Function that listens to the Pub/Sub topic, to automate cost management.