[MUSIC PLAYING]
MARINA: Hi, everyone, and welcome back to the series
"How Firebase Projects Work."
We already covered how to set up your Firebase project
and Firebase apps and the best practices
recommended by the Firebase team.
We also deep dived into how to use multiple Firebase projects
to support different environments.
In this third episode, we are going
to cover the difference between Firebase's pricing plans,
how we can estimate the cost of your project,
and how you can set up your billing account.
I will also share some tips on how
you can have more control of your costs
and avoid surprise bills.
Firebase offers two different pricing plans, the Spark plan
and the Blaze plan.
Spark is the default pricing plan
that you are automatically enrolled
in when you create a new Firebase project,
and it requires no payment information.
In this pricing plan, you'll get full usage of no-cost Firebase
products and features and a usage quota for paid Firebase
products.
This is ideal for the first stages of your application
development.
And if you're only using Firebase products,
there are no costs-- like Firebase Cloud Messaging,
Crashlytics, Remote Config, and so on.
You can keep using this pricing plan
when your app goes to production too.
But if you're using one of our products that have usage quota,
we recommend switching to the Blaze plan
before shipping your app to production.
This is highly recommended because if you exceed the usage
quota in a calendar month for any product,
your project's usage of that specific product
will be shut off for the remainder of that month.
And this will affect all the apps
that you have registered under that Firebase project.
All projects in the Blaze plan have a Cloud billing account
attached to it.
This enables these projects and the apps registered under them
to access more services and higher usage levels.
We'll talk about how you can set up your billing account later
in this video.
First, let's check what is included in the Blaze plan.
Once you switch to the Blaze plan,
you switch to a pay-as-you-go pricing model,
which means that your project will still have the usage
quotas for paid Firebase products,
and you will only pay for additional usage.
If your project stays within the quotas established
for disparate products, you won't see any billing
at the end of the month.
Last, but not least, you'll gain access to paid Google Cloud
products and features like Cloud Run and BigQuery Streaming
for Analytics.
Now that you know the difference between the pricing plans,
you might be wondering whether to switch to the Blaze plan
or not.
The best thing to do to find out which pricing plan is
right for you is to look at the usage quotas for each product
and measure whether these are sufficient for the scope
of your app.
Most Firebase products and features
have quotas and pricing based on daily usage,
but some are based on monthly or hourly usage.
You can check the list of products that are no-cost
and what the limits are for the products that
have usage quota in the official pricing documentation that you
see here, also linked in the video description.
In addition to documentation, Firebase also
has a Blaze plan calculator that can
help you to get an estimate for your monthly cost
on the Blaze plan.
In this calculator, you can estimate
what will be the amount to be paid at the end of the month,
based on how much you use each of the paid products.
Just check the bar of each product,
based on the unit of measure it asks for.
And when you scroll to the bottom of the page,
you will have an estimate of your monthly cost.
You can find a link to this calculator in the description.
And if you're new to Firebase and want to try the paid
products before switching to the Blaze plan,
you can use the Google Cloud free trial.
All new Google Cloud and Firebase users
can have a 90-day trial period that
includes $300 in free Cloud billing credits
to explore and evaluate Google Cloud and Firebase products
and services.
During the trial period, you'll be provided a free trial Cloud
billing account.
And any Firebase project that uses that billing account will
be on the Blaze pricing plan during the free trial period.
All right, now that you have all the tools to find out
which pricing plan is best for you,
let's see how you can switch between plans.
To upgrade your project from Spark to Blaze,
your project needs to be associated with a Google Cloud
billing account, which requires a payment method.
This includes most major credit cards, bank accounts,
and PayPal payment methods.
You can associate multiple Firebase projects
with a single Cloud billing account,
so you don't have to set up your billing account every time
you need to create a new Firebase project.
The first step you need to do is to create a new Google Cloud
billing account, and you can do that from within the Firebase
Console.
Just open the project you want to switch to the Blaze plan
and click on the Upgrade button available on the bottom
of the side menu.
You will see a window with a summary of each plan
where you can select the one that fits your needs.
If you select the Blaze plan option,
you will see a warning, letting you
know that projects are shared between Firebase and Google
Cloud and that you will be taken to the Google Cloud Console
to create a billing account.
Then, you can click on the Continue button
and follow the steps showing Google Cloud to set up
your billing profile.
As soon as you create your billing account,
your Firebase project will be automatically switched
to Blaze plan.
Alternatively, if you use any Google Cloud Services or Google
Maps APIs in the same project--
which also requires setting up a billing account--
this automatically upgrades your Firebase pricing plan
to the Blaze plan.
If you ever want to go back to the Spark plan,
you can follow the same steps in the Firebase Console
and select the Spark plan once again.
You can also do it via the Google Cloud Console
by removing the associated Cloud billing
account from your project.
But be aware that a few things might happen when you downgrade
your pricing plan.
If you were using Cloud Functions before,
you won't be able to do new deploys of any new
or any existing functions.
Your Firebase project will lose access to any paid Google Cloud
Services, like Cloud Run and BigQuery Streaming
for Analytics.
Your Firebase project will also lose access
to any known default Realtime Database
instances or known default Cloud Storage buckets.
The data in these instances won't get deleted,
but you won't have access to the data
unless you switch back to Blaze plan.
If you do decide to keep your upgraded pricing plan,
let's take a look at the tools that Firebase
offers so you can have more control of your costs.
There are some steps you can take
to gain control of your costs, like testing
your code correctly, constantly monitoring
the usage of paid products, and setting up email alerts.
Testing a code is a very important part
of the development process.
And we highly recommend testing your code
in a testing environment before shipping it to production.
When using a different environment,
you can use the Firebase Emulator
Suite to test your application.
It ensures that you don't incur any Firebase costs that
might result from testing against services in production.
You can watch this video link in the description
to learn more about setting up different Firebase
projects to different environments
and how to use the Emulator Suite for testing.
Even with tested code, as humans, we all make mistakes.
So let's see how we can monitor usage of paid products.
Open your Firebase project and navigate to the usage
and billing page where you can view your monthly usage
and how your usage levels are measuring up
to the no-cost usage quota.
You can also click on any product displayed on this page
to view the daily summary of its usage.
In addition to monitoring product usage,
you can also set up email alerts based
on a budget that you define in your Google Cloud billing
account.
By predefining this amount and setting up email alerts,
you and your team will receive an email
if you exceed this spend threshold.
You can also create more sophisticated billing logic
and alerts.
For example, you can send alerts to select channels
or via text message.
Or you can make programmatic changes to your app or project,
depending on spend levels.
The instructions to create billing alerts
and advanced logic are available in the official documentation
linked in the description below.
As a note, alerts don't stop the product usage.
Firebase doesn't turn off services and usage
because you might just be experiencing
a positive growth of your app, and we
don't want your app to shut down when
you need it to work the most.
If you still have questions regarding Firebase pricing
plans, we have a frequently asked
questions page with lots of useful information
on this topic.
You can find this and all the links
we discussed in the video description below.
And that's all I wanted to share with you today.
Thanks for watching and see you soon.
[MUSIC PLAYING]