I'm trying to launch a compute instance into GCP using the command line:
gcloud compute instances create instance-1 --zone=uscentral1-a
And it tells me that billing is not open for the project:
API [compute.googleapis.com] not enabled on project [847006780503].
Would you like to enable and retry (this will take a few minutes)?
(y/N)? Y
Enabling service [compute.googleapis.com] on project [847006780503]...
ERROR: (gcloud.compute.instances.create) FAILED_PRECONDITION: Billing account for project '847006780503' is not open. Billing must be enabled for activation of service(s) 'compute.googleapis.com,compute.googleapis.com,compute.googleapis.com' to proceed.
- '@type': type.googleapis.com/google.rpc.PreconditionFailure
violations:
- subject: ?error_code=390002&project=847006780503&services=compute.googleapis.com&services=compute.googleapis.com&services=compute.googleapis.com
type: googleapis.com/billing-enabled
- '@type': type.googleapis.com/google.rpc.ErrorInfo
domain: serviceusage.googleapis.com/billing-enabled
metadata:
project: '847006780503'
services: compute.googleapis.com,compute.googleapis.com,compute.googleapis.com
reason: UREQ_PROJECT_BILLING_NOT_OPEN
I am able to launch compute instances in the console, but not on the CLI.
How do I enable billing for my project so that I can launch instances with the CLI?
If billing is not enabled on the project, a pop-up window will display, with text similar to:
"This project is not linked to a billing account"
If this is your case, you can enable billing on your project following this documentation: Enable billing for an existing project
Sign in to the Manage billing accounts page in the Google Cloud Console.
Select the My projects tab to view a list of projects and the associated Cloud Billing account for each project.
From the list of projects, locate the project for which you want to re-enable billing, and then click the menu next to it.
Select Change billing, then choose the desired destination Cloud Billing account.