Cloud Run - getting started checklist
Published: 2023-12-01 22:26:55

To get started developing for [Cloud Run](https://cloud.google.com/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 up for GCP](#sign-up-for-gcp)

1. Sign in with a Google account
2. Create a billing account

[Set up your machine](#setup-your-machine)

- Install the Google Cloud CLI

[Set up a cloud project](#set-up-a-cloud-project)

1. Log in at the terminal:

    gcloud auth login

2. Create a project

    gcloud projects create PROJECT_ID

3. Link the project to a billing account

    gcloud billing projects link PROJECT_ID --billing-account ACCOUNT_ID

4. Delete the project when no longer needed

    gcloud projects delete PROJECT_ID

## Checklist walkthrough

The [Cloud Run Documentation](https://cloud.google.com/run/docs) 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.

1. [Sign up for GCP](#sign-up-for-gcp)
2. [Set up your machine](#set-up-your-machine)
3. [Set up a cloud project](#set-up-a-cloud-project)

## Sign up for GCP

To use GCP, you'll need to sign up:

1. [Sign in with a Google account](#sign-in-with-a-google-account)
2. [Create a billing account](#create-a-billing-account)

### Sign in with a Google account

Go to [Google Cloud Platform](https://cloud.google.com/), 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:

- [Free Trial](https://cloud.google.com/free/docs/free-cloud-features#free-trial)
- [Free Tier](https://cloud.google.com/free/docs/free-cloud-features#free-tier)

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](https://cloud.google.com/free/docs/free-cloud-features#free-tier-usage-limits).

For more details, see [Google Cloud Free Program](https://cloud.google.com/free/docs/free-cloud-features).

### 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](https://console.cloud.google.com/billing) in the console.

## Set up your machine

The `gcloud` CLI is a useful tool that is available online in the [Cloud Shell terminal](https://shell.cloud.google.com/?show=terminal), but since most developers like to work with editors on their own machines, I highly encourage you to [install the Google Cloud CLI](#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:

1. [Log in at the terminal](#log-in-at-the-terminal)
2. [Create a project](#create-a-project)
3. [Link the project to a billing account](#link-the-project-to-a-billing-account)
4. [Delete the project when finished](#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](https://cloud.google.com/resource-manager/docs/creating-managing-projects#before_you_begin) 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](https://console.cloud.google.com/billing).

    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](https://cloud.google.com/resource-manager/docs/creating-managing-projects#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.