To get started developing for Cloud Run, you need to take of a number of administrative steps first.
I've edited the original article to move the Recap to the top and rename it to Checklist. This is all you need. The rest of the article is here to provide you with extra detail if it's your first time running through the checklist.
Checklist
- Sign in with a Google account
- Create a billing account
- Install the Google Cloud CLI
-
Log in at the terminal:
gcloud auth login
-
Create a project
gcloud projects create PROJECT_ID
-
Link the project to a billing account
gcloud billing projects link PROJECT_ID --billing-account ACCOUNT_ID
-
Delete the project when no longer needed
gcloud projects delete PROJECT_ID
Checklist walkthrough
The Cloud Run Documentation is the ultimate source of truth, but I created this article as a checklist to help developers who are new to the platform get set up for a following series of Cloud Run blog posts that will refer to this as a prerequisite.
Sign up for GCP
To use GCP, you'll need to sign up:
Sign in with a Google account
Go to Google Cloud Platform, click Get started for free, and sign in with a Google account. If you don't already have a Google account, then click Create account and follow the prompts.
When you activate a GCP account, you get access to both of the following:
Currently, the Free Trial provides $300 of Cloud Billing credits to pay for resources for ninety days while you explore GCP.
The Free Tier provides access to GCP products for free beyond the free trial as long as you stay below the Free Tier usage limits.
For more details, see Google Cloud Free Program.
Create a billing account
If you use the free trial, Google creates a billing account for you and applies the free credits to your account.
Once the free trial period ends, you can continue to use the free tier, but you're required to set up a billing account to cover any costs that exceed free tier usage limits.
If you need to create a billing account, go to Billing in the console.
Set up your machine
The gcloud
CLI is a useful tool that is available online in the Cloud Shell terminal, but since most developers like to work with editors on their own machines, I highly encourage you to install the Google Cloud CLI on your own machine as well.
Set up a cloud project
A cloud project refers to the set of cloud infrastructure (compute, databases and other storage, load balancers, etc.), resources (container images, secrets, static assets, etc.), and security controls for your application (or collection of related applications).
When you create a new cloud project, follow these steps:
- Log in at the terminal
- Create a project
- Link the project to a billing account
- Delete the project when finished
Log in at the terminal
gcloud auth login
Create a GCP project
If you already have a specific GCP project to use, you can skip this.
Once you're logged in, you can create a new GCP project using the gcloud projects create command.
This is the command to create a project called project-foo:
gcloud projects create project-foo
There are a few things to keep in mind when choosing a project ID. The project ID must:
- Be globally unique within Google Cloud.
- Be 6 to 30 characters long.
- Only contain lowercase letters, numbers, and hyphens.
- Start with a letter and must not end with a hyphen.
- Not be or have ever been in use.
- Not contain restricted strings.
See the Before you begin section for Google Cloud's Resource Manager if you want to see more details and further restrictions.
Link the project to a billing account
If you're using an existing project that already has billing linked to it, you can skip this.
Once you've created the project, you must link it to a billing account. You can find your billing account ID on your billing accounts page.
gcloud billing projects link my-amazing-project --billing-account 0X0X0X-0X0X0X-0X0X0X
Delete the project when no longer needed
If you're creating a test project, you'll want to remember to delete it when you're finished. Deleting a project will terminate or release resources associated with it so they no longer incur any potential usage fees.
Using the example project (project-foo
) created previously:
gcloud projects delete project-foo
Caution!
It should go without saying that you want to be really sure you want to delete a project. A deleted project immediately becomes unusable, although it can be restored within a 30-day recovery period. See Restoring a project if you need to stop the delete process.
Next
In the next article, get started generating the TypeScript boilerplate and deploy to Cloud Run.
Top comments (0)