[MUSIC PLAYING]
ERICA CHUONG: Hi, everyone.
I'm Erica Chuong, a partner engineer at Google Cloud.
Welcome back to Google Cloud Technical Guides for Startups,
where we're creating a series of videos for technical enablement
to help startups set up their own Google Cloud platform
environment and grow their businesses successfully
and sustainably on Google Cloud.
This episode focuses on setting up billing and alerts
and optimizing costs on Google Cloud, which I know
is everyone's favorite topic.
The good news is Google Cloud makes billing management
and optimization really easy.
In this video, we're going to cover Google Cloud resources,
billing administration, discounting,
and additional resources.
So without any further ado, let's
get right on into exploring the Google Cloud platform together.
If you're new to Google Cloud, please
refer to video 2 of the series, which
discusses Google Cloud resources, organizations,
and permissions.
These concepts will be important when it comes
to billing administration.
A billing admin is responsible for much more than just
making sure invoices get paid.
They're also responsible for managing payment instruments,
configuring billing exports, viewing cost information,
and managing user roles on the billing account.
The way Cloud computing is charged and billed,
it's a little of a shift in mindset from what
most companies are used to.
Instead of one-and-done data center purchases,
billing is done monthly and is consumption-based.
Managing cost becomes a little bit different,
which we'll get into when we discuss budgets and alerts.
In order to connect a project to a billing account,
you need to have the correct permissions granted
on both the project and billing account levels.
The minimum roles required include billing account user
on the billing account and project billing manager
on the project or resource associated.
Higher permissions, such as project owner,
will work as well but are unnecessary due
to least-privilege design.
While on the topic of permissions,
it's important to note that when a new billing account is
created, the user creating it is usually also given the payment
profile admin role on the payment profile.
If you do need to change the billing account admin
role to someone else for whatever reason,
remember to also change the payment profile admin rule.
So what is a billing account specifically?
A billing account is essentially how you pay for projects.
Projects can exist without a billing account
thanks to the free tier that many Google products have,
but you're limited to quotas.
To fully operate, a project must have a billing account
associated to it.
A billing account is just where costs and charges are bucketed.
And this also represents a customer's legal relationship
with Google.
The billing account is then both a legal and financial entity--
an organization compared to billing account
with the organization and contractual obligation
between Google and the customer exists at the billing account
level.
There are two types of billing accounts.
There's invoiced or offline.
And that just refers to accounts that are invoiced on net terms,
typically 30 days, and have a signed contract associated.
There's also self-serve or online,
and that refers to accounts that sign up
in a self-service manner with a credit
card, debit card, or bank transfer
and are charged when payment becomes due.
Most organizations will have a single billing account,
but some may have multiple.
Generally, if you have multiple, it's
due to legal or accounting reasons,
or maybe they need to pay in multiple currencies.
Something to keep in mind is that having multiple billing
accounts can mean additional overhead
and could make things tricky to track and manage
depending on how many you have.
So just be cognizant of that before you
start setting up multiple.
A project could only be assigned to one billing account,
but a billing account can be tied to multiple projects.
A billing account is managed through the Google Cloud
Console.
A billing account is specific to Google Cloud resources,
but there is another resource called a payments profile,
which I mentioned earlier, which is a general Google billing
resource and applicable for other services such as Maps
and Ads.
Your billing account is linked to your payment profile.
You can see and manage everything at pay.google.com.
This is essentially just a collection
of payment information such as mailing addresses
and forms of payments for the organization as a whole.
So let's take a look at what this looks like in the Console
itself.
This is the interface of a billing account.
The billing ID is at the top.
This is automatically generated for you.
You have your billing admin.
You can have multiple here.
This person can add additional admins and users
and assign permissions directly on the billing account.
Each project you create will be linked to a billing account.
And here you can also see which projects
are linked to that particular billing account.
When you create a new project, it
will ask you which billing account
you'd like to associate.
You can also suspend a project to stop billing at any time.
Something to keep in mind is that projects and billing
accounts do not necessarily need to be in the same organization.
As long as the user has the correct permissions
to set up the relationship between the billing
account and a project, they could be anywhere.
So you could manage things cross-organizationally as well.
So now that you have your resources and billing accounts
set up and running, you may be wondering,
how do I see what resources says I'm using
and where are my largest costs coming from?
That's relatively easy, and there are a few ways
that you can do this.
So first, you have your Cloud Console billing reports.
These are going to give you general information
on your spend, and they're ready to go, ready-made.
Examples here.
Another option is your monthly invoice.
This will show you details of consumption associated
with a billing account.
Depending on how many resources you've consumed,
your bill could be quite lengthy.
So it might be a lot to sift through.
Another option is to build a customized billing
dashboard in BigQuery, Data Studio,
or a BI tool of your choice.
This will give you more granular reporting, analysis,
and visibility and allow you to really slice and dice your data
and derive insights from it.
So let's take a look at an example of one
of these dashboards built in Data Studio.
So a Data Studio dashboard such as this one
can give you a more visual view of your billing.
This dashboard has multiple different views to give you
different levels of detail.
The first is going to be our GCP cost summary.
We can see we have year-to-date costs, quarter-to-date costs,
month-to-date costs.
We also see trends month over month, change in dollars.
You can also add visuals such as pie charts
to allow you to easily slice and dice your data
and see how much of each service is contributing
to your overall bill.
You can also filter based on labels.
In this particular dashboard, we've
added granularity on the team, Google Cloud platform service,
and environment levels.
So environment could also just be production and deployment.
So let's take a look at our cost-by-team view.
So once this loads, we can see that we
have four different teams.
And with this, we can get granularity pretty easily.
So very quickly, I can see that almost 50% of billing
is by the pso team, 33% is by the engineering team,
and 16% is by the networking team.
Over on the right-hand side, we also
have a trend analysis to which we
can see how our data is moving over a time basis.
At the top, we also have filters.
So if I wanted to filter by date range, metric, project,
or GCP service, those are options as well.
Again, slice and dice for data.
The same views can be seen on an environment basis as well.
These labels were created on the project level
and were included in the queries used to export the data.
So currently, we only have one environment.
It's production in this case.
But we can very easily see that we've accrued a cost of $827.
And same thing as we saw before, we
have a graph on the right-hand side that
shows our trend analysis.
This is actually a premade template
that you can re-use with your own billing export data.
And there are instructions on how
to do so within the bottom tab right here.
Next is managing our monthly spend.
So we really want to remain on target to see where we are,
and that's where budgets and alerts come in.
So alerts are important to avoid any sort of billing surprises.
And you can set up multiple alert percentages
to get notifications as usage continues to increase.
So for example, if I wanted to be
notified when I reached 50%, 75%, and 90% of my budget,
I can do so.
You can set notifications up in your email,
or you can set them to automatically take
action using Pub/Sub, Cloud Functions, or Cloud Run.
This could include shutting down a resource,
or changing your resource usage, or sending notifications
to a ticketing system such as ServiceNow.
There's also a forecast trigger.
So this will allow you to be notified
as soon as you are forecasted to reach a budget
by the end of the month.
This allows you to make changes to lower
your spend if needed and is a much more proactive rather
than reactive response.
So as mentioned when I showed that Data Studio dashboard,
labels can help you manage Cloud applications at scale.
So they offer clarity into resources being used
and can help deploy, monitor, and manage
at an individual application level.
They can give visibility into usage by department or group
and help with cost control and resource management.
So we all love discounts and optimization.
And here are just a few ways to do so
within your GCP environments.
So CUDs, or Committed Use Discounts,
allow users to prebuy in bulk.
Committed Use Discounts are ideal for workloads
with predictable resource needs.
When you purchase a Committed Use Discount,
you purchase Compute Engine resources
such as vCPUs, memory, GPUs, local SSDs, and sole tenant
nodes at a discounted price in return
for committing to paying for those resources for one
or three years.
The discount is up to 57% for most resources
like machine types and GPUs.
The discount can also be up to a whopping 70%
for memory-optimized machine types.
For Cloud SQL, it's a little bit different.
You commit to a consistent amount
of usage measured in dollars per hour of equivalent on-demand
spend for a one or three-year term.
In exchange, you receive a discounted rate
on the applicable usage your commitment covers.
So you can purchase Committed Use Discounts
from any Cloud billing account.
And the discount applies to any eligible usage on projects paid
for by that billing account.
Any sort of overages are then charged at an on-demand rate.
There's also Sustained Use Discounts,
and these are one of GCPs larger points of differentiation.
So this is basically a large discount
on Compute Engine resources for workloads
that are run for a significant portion of the month.
There's also preemptible VMs.
And this is another great way to lower costs
if you have workloads that are fault-tolerant and can
withstand possible instance preemptions.
Discounts for these can be up to 80%.
I suggest talking to your sales team
to see how you can optimize your environment
and really take advantage of any applicable discounts.
So with that, we have tons of resources and guides
around setting up billing on our documentation site.
I highly encourage you to take a look
prior to setting everything up in your own environment.
Should you run into any issues, our billing support team
is always available as well.
A couple of resources have been added to the description box
below to help you understand these concepts
in further detail.
So please check them out.
This brings us to the end of the video
where we covered Google Cloud resources, billing admin,
discounting, and additional resources.
Stay tuned for all of the exciting content
that we have in store for you.
And don't forget to like and subscribe
on our YouTube channel.
Click on the bell icon to be notified each time
a new video is posted, and we will see you very soon
in our next video.
Thank you.
[MUSIC PLAYING]