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.

Creating a Cloud Tasks queue

Use the Google Cloud SDK to create your queue:

    gcloud tasks queues create QUEUE_ID --location=LOCATION_NAME

where:

  • LOCATION_NAME is the location where the queue runs, for example, europe-west4.
  • QUEUE_ID is 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

The output should be something like:

name: projects/PROJECT_ID/locations/LOCATION_NAME/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 above 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_NAME

    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 Cloud console

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

What's next