This guide shows how to set up your Google Cloud project before using the Google Maps Platform APIs. While you may have completed some of these steps in the Quickstart or Getting started with Google Maps Platform page, this topic provides additional, useful instructions for managing your projects.
Creating a project
To use Google Maps Platform, you must have a project to manage services, credentials, billing, APIs, and SDKs.
Billing setup is required for each project, but you will only be charged if a project exceeds its free quota.
To create a Cloud project with billing enabled:
Create a new Google Cloud project in the Cloud Console:Create new project
On the New Project page, fill in the required information:
Project name: Accept the default or enter a customized name.
You can change the project name at any time. For more information, see Identifying projects.
Project ID: Accept the default or click EDIT to enter a customized ID that Google APIs use as a unique identifier for your project.
After you create the project, you cannot change the project ID, so choose an ID that you'll be comfortable using for the lifetime of the project. Don't include any sensitive information in your project ID.
Billing account: Select a billing account for the project. If you haven't set up a billing account or only have one billing account, you won't see this option.
You must be a Billing Account Administrator or Project Billing Manager to associate a project with a billing account. For more information, see the billing access control documentation.
Location: If you have an organization you want to link your project to, click Browse and select it; otherwise, choose "No organization".
For more information, see Creating and Managing Folders and Relationships between organizations, projects, and billing accounts.
gcloud projects create "PROJECT"
To deploy your apps, you must enable billing. Your account will not be charged if you stay within your free quota. If your application needs resources that exceed the free quota, you will be charged for the additional usage.
If you have a billing account when you create a Cloud project, then billing is automatically enabled on that project.
To enable billing on a Cloud project:
In the Cloud Console, go to the Billing page:
Select or create a Cloud project.
Depending on if a billing account exists or if the selected Cloud project is associated with an account, the Billing page displays one of the following:
If billing is already enabled for the selected Cloud project, then the details about the billing account are listed.
If no billing account exists, you are prompted to create a billing account and associate it with the selected Cloud project.
If a billing account exists, you are prompted to enable billing if the selected Cloud project is not already associated with a billing account. You can also click Cancel and then click Create account to create and associate a new billing account.
To use Google Maps Platform, you must enable the APIs or SDKs you plan to use with your project.
gcloud services enable \ --project "PROJECT" \ "directions-backend.googleapis.com"
Viewing enabled APIs
To view the APIs or SDKs you have enabled, go to the Google Maps Platform page in the Cloud Console:Go to Google Maps Platform page
- Additional APIs: These API or SDKs are not enabled.
- If you see cards for each Map APIs and services, no APIs or SDKs have been enabled.
gcloud services list --project "PROJECT"
Select a project in the Cloud Console:
Perform the following management tasks:
- See an overview of your billing account, make payments, and add billing account administrators from the Overview page. We recommend having multiple Project Owners and Billing Administrators, so that you'll always have someone with these roles available to your team.
- Create budgets and alerts on the Budgets & alerts page.
- View your transaction history and download invoices from the Transactions page.
- Export your billing data from the Billing export page.
- Configure your payment account and contacts on the Payment settings page.
- Set the method of payment on the Payment method page.
For more information about billing, see Google Maps Platform Billing.
Creating budgets and setting alerts
You can create a budget for a Cloud project to avoid surprises on your bill and monitor all of your Cloud charges from one place. With a budget, you can create alerts that send emails to your billing administrators when charges exceed a certain amount.
To create a budget and set alerts in a Cloud project:
In the Cloud Console, go to the Billing page:Go to the Billing page
- Click Budgets & alerts and then Create budget to begin creating a budget for your Cloud project.
- Define your budget in the Set budget section and specify the percentages for which you want to receive email alerts in the following Set budget alerts section.
- Click Finish to set the budget and enable alerts for your Cloud project. If you have multiple Cloud projects, you must individually set budgets and alerts in each project.
Enable the necessary API to create a billing budget.
gcloud services enable \ --project "PROJECT" \ billingbudgets.googleapis.com
Set a budget to alert at 50% actual spend and again at 75% of forecasted spend.
gcloud billing budgets create \ --project "PROJECT" \ --billing-account="BILLING_ACCOUNT" \ --display-name="BUDGET_NAME" \ --budget-amount=AMOUNTUSD \ --threshold-rule=percent=0.5 \ --threshold-rule=percent=0.75,basis=forecasted-spend
Shutting down a project
You can disable billing and release all the Cloud resources that are being used in your Cloud project by shutting down that project:
Go to the Projects page:Go to the Projects page
Select the Cloud project that you want to shut down, then click Delete.
For more information about managing your Cloud projects, see Cloud Resource Manager: creating, shutting down, and restoring projects.
gcloud projects delete "PROJECT"
After setting up your Google Cloud project, you must create and secure your API Key to use the Directions API: