Create Cloud Tasks queues

This page describes how to create Cloud Tasks queues using the gcloud command of the gcloud CLI.

Before you begin

Queue names consist of three parts: a project ID, a location, and a queue ID. For all target types, you must have a Google Cloud project, which provides the project ID.

If you are using App Engine target tasks, you must also have an App Engine app. The app is located in a specific region and this region serves as the location part of the queue name, so make a note of it when you add the app. This location is where your queue and your handlers run.

Using HTTP Target tasks, on the other hand, does not require an App Engine app. You select a Google Cloud location when you create your queue.

Create a Cloud Tasks queue

Use the Google Cloud SDK to create your queue:

    gcloud tasks queues create QUEUE_ID --location=LOCATION

Replace the following:

  • LOCATION: the location where the queue runs, for example, europe-west4.

    • If your organization restricts resource location and you want to create your queue in either us-central1 or us-central2, the organization policy must allow queue creation in both us-central1 and us-central2 (even if you only need a queue in one of those regions).
  • QUEUE_ID: the identifier you assign to your queue, for example, my-queue.

It can take a few minutes for a newly created queue to be available. Then use describe to verify that your queue was created successfully:

   gcloud tasks queues describe QUEUE_ID --location=LOCATION

Replace the following:

  • QUEUE_ID: the queue ID (its short name)
  • LOCATION: the location of the queue

The output should be something like:

name: projects/PROJECT_ID/locations/LOCATION/queues/QUEUE_ID
rateLimits:
  maxBurstSize: 100
  maxConcurrentDispatches: 1000
  maxDispatchesPerSecond: 500.0
retryConfig:
  maxAttempts: 100
  maxBackoff: 3600s
  maxDoublings: 16
  minBackoff: 0.100s
state: RUNNING

If you do not see the preceding output, you can try the following:

  • Wait at least one minute for the queue to initialize.
  • Make sure a queue with the same ID does not already exist. You can view the queues in your project by calling:

    gcloud tasks queues list --location=LOCATION

    To search multiple locations you need to make multiple requests.

  • Check if you've reached your queue limit:

    Go to the Cloud Tasks API page

    and select Quotas.

    To increase your resource limits, select Edit Quotas from the Quotas page of the Google Cloud console

  • Check each part of the command and re-run it.

What's next