How to Enable Cloud Pub/Sub API for App Engine

Setting up cloud projects and accounts. Managing service accounts.

You want to send and consume Cloud Pub/Sub messages from your App Engine application. The Cloud Pub/Sub API is currently disabled. You will use a service account to authenticate your application to the API. You want to make sure your application can use Cloud Pub/Sub. What should you do?

  1. Enable the Cloud Pub/Sub API in the API Library on the GCP Console. Correct Answer
  2. Rely on the automatic enablement of the Cloud Pub/Sub API when the Service Account accesses it.
  3. Use Deployment Manager to deploy your application. Rely on the automatic enablement of all APIs used by the application being deployed.
  4. Grant the App Engine Default service account the role of Cloud Pub/Sub Admin. Have your application enable the API on the first connection to Cloud Pub/ Sub.
Answer Correct answer: A — Enable the Cloud Pub/Sub API in the API Library on the GCP Console so the App Engine service account can authenticate to it.

Community Insight

The question tests whether a disabled GCP API can be turned on implicitly; the trap is assuming service-account access or Deployment Manager deployment will auto-enable the Cloud Pub/Sub API.

Cloud Pub/Sub must be explicitly enabled per project before an App Engine application can publish or consume messages with its service account. This page confirms that enabling the Cloud Pub/Sub API in the Console API Library is the required first step, and explains why automatic enablement options fail.

Option B is the most common wrong pick, because learners assume that a service account's first authenticated call automatically enables the API — Google Cloud has no such automatic enablement for disabled APIs.

Community Discussion (34 comments)

Gayathree 👍 1 Selected: A
a
Cloudmoh 👍 1 Selected: A
Yes, the Cloud pub/sub-API should be enabled.
Romio2023 👍 1
hello test
Captain1212 👍 1
Yes A, is more correct as first you need to enable the API itself
bidyut123 👍 2 Selected: A
ANSWER SHOULD BE A.
Buruguduystunstugudunstuy 👍 9 Selected: A
Answer A is correct. Enable the Cloud Pub/Sub API in the API Library on the GCP Console. Since the Cloud Pub/Sub API is currently disabled, the first step is to enable it. This can be done through the API Library on the GCP Console. Once the API is enabled, the service account can be used to authenticate the App Engine application to the Cloud Pub/Sub API. Answer B is incorrect because there is no automatic enablement of APIs when a service account accesses them. The API needs to be enabled manually in the API Library or through the command-line interface. Answer C is incorrect because enabling APIs through Deployment Manager requires that the APIs be enabled in the project before Deployment Manager can use them. Answer D is incorrect because granting the App Engine Default service account the Cloud Pub/Sub Admin role could be a security risk, and it is not necessary to enable the API.
AzureDP900 👍 1
A is right
sedado77 👍 3 Selected: A
Yup its A
haroldbenites 👍 1
go for A
Schladde 👍 2 Selected: A
A is correct, although there are options to activate APIs programmatically (gcloud, curl) https://cloud.google.com/service-usage/docs/enable-disable B and C are incorrect because "rely on ..." is never a good option D could be possible, but to much permissions are given to the app
gielda211 👍 1 Selected: A
A is correct
flashlight01 👍 1 Selected: A
Enable the Cloud Pub/Sub API in the API Library on the GCP Console.
obeythefist 👍 2
This question seems to be asking "Can you automatically enable the API or do you have to do it manually?" and I think the answer is that there's no automatic enablement of the API.
shawnkkk 👍 2
A. Enable the Cloud Pub/Sub API in the API Library on the GCP Console.
vishnukumartr 👍 1
A. Enable the Cloud Pub/Sub API in the API Library on the GCP Console.
Jaira1256 👍 1
A is correct
vikram___ 👍 1
Enabling API is the first step before using it, Ans A
Nick334 👍 1
I am also looking for it.
Kaushik_Mallick 👍 4
Does anyone has latest questions & answers. Also if you guide me the reading material/blog/portal to pass this exam.
BAGCP 👍 1
Even i also want this information
mcaromit 👍 2
As a first step A is the correct answer
gspb 👍 1
In the question - "You want to make sure your application can use Cloud Pub/Sub" Since we want to make sure that our application uses pub/sub, enabling it manually is the best option. Hence, option A is correct
ggalvez 👍 2
Es A. Nunca esta habilitada la API PUB/SUB
nliaustemac 👍 1
A. is the correct answer: Enable the Cloud Pub/Sub API in the API Library on the GCP Console.
GCP_Student1 👍 2
A. Enable the Cloud Pub/Sub API in the API Library on the GCP Console.
iPablo26 👍 1
Enable the Cloud Pub/Sub Api
Gohs 👍 2
Not all API are enabled by default so you have to manually enable the API you'll need.
INASR 👍 1
Sure A , you need to enable API for any service you want to use in google
Dineshvon 👍 1
A is correct
swatititame 👍 1
• A. Enable the Cloud Pub/Sub API in the API Library on the GCP Console.
glam 👍 2
A. Enable the Cloud Pub/Sub API in the API Library on the GCP Console.
SSPC 👍 1
A is correct
ESP_SAP 👍 33
Correct Answer is (A) Quickstart: using the Google Cloud Console This page shows you how to perform basic tasks in Pub/Sub using the Google Cloud Console. Note: If you are new to Pub/Sub, we recommend that you start with the interactive tutorial. Before you begin Set up a Cloud Console project. Set up a project Click to: Create or select a project. Enable the Pub/Sub API for that project. You can view and manage these resources at any time in the Cloud Console. Install and initialize the Cloud SDK. Note: You can run the gcloud tool in the Cloud Console without installing the Cloud SDK. To run the gcloud tool in the Cloud Console, use Cloud Shell . https://cloud.google.com/pubsub/docs/quickstart-console
Bharathy 👍 25
We need to enable the pub/sub API, if we are going to use it in your project... then APP engine can able to access it with required ServiceAccount

Comments & Corrections

No comments yet — spotted an error or have a note? Share it below.

Log in to comment, report an error, or add a note about this question.

Submitted for moderation before publishing. Keep it helpful and respectful.

Expert Analysis

Why the Answer Is Correct

The Cloud Pub/Sub API is explicitly stated as disabled, and in Google Cloud an API must be enabled for the project before any client, including an App Engine app using the App Engine Default service account, can call it. Enabling it in the API Library of the GCP Console (option A) is the documented, least-privileged way to make the API usable. Once enabled, the service account can simply authenticate to the API with whatever Pub/Sub roles it has been granted, with no extra permissions needed for setup. As ESP_SAP's quoted quickstart notes, the flow is "Set up a Cloud Console project... Enable the Pub/Sub API for that project."

Why the Other Options Are Wrong

Option B is wrong because there is no automatic API enablement triggered when a service account first accesses a disabled API — the call would simply fail with a permission/enabled-API error. Option C is wrong for the same reason: Deployment Manager does not magically enable every API a deployed application touches; APIs used by a deployment must be enabled beforehand. Option D is wrong because enabling an API from inside the application requires serviceusage.services.enable and would hand the app the excessive Cloud Pub/Sub Admin role, which contradicts least privilege — Schladde noted that "D could be possible, but to much permissions are given to the app."

Community Comment Notes

The community overwhelmingly converges on A, with Buruguduystunstugudunstu explaining that "Since the Cloud Pub/Sub API is currently disabled, the first step is to enable it" via the API Library. Schladde adds nuance that APIs can also be enabled programmatically with gcloud or the Service Usage API, but still concludes A for this question, observing that "rely on..." is never a good option. obeythefist frames the underlying doctrine correctly: "there's no automatic enablement of the API," which eliminates both B and C.

Official Reference

Exam Strategy

Treat any "API is currently disabled" stem as an enablement question first and an IAM question second — the correct answer is almost always an explicit enable step in the API Library. Reject any option that says the platform will enable the API automatically, and reject options that grant broad admin roles to the application just to perform setup.

Frequently Asked Questions

Why can't the service account auto-enable the Cloud Pub/Sub API on first access?

Google Cloud has no automatic enablement for disabled APIs; a first call to a disabled API simply fails until an admin enables it for the project.

Why is granting Cloud Pub/Sub Admin to enable the API a bad answer?

It forces the app to hold serviceusage.services.enable plus a broad admin role at runtime, violating least privilege when a one-time Console enable step suffices.

More ACE FAQ →

Related Analysis

Practice All ACE Questions

Access 84 questions with complete answers and detailed explanations.

View Full ACE Practice Test →

← Back to ACE Study Guide