exam questions

Exam Professional Cloud Developer All Questions

View all questions & answers for the Professional Cloud Developer exam

Exam Professional Cloud Developer topic 1 question 77 discussion

Actual exam question from Google's Professional Cloud Developer
Question #: 77
Topic #: 1
[All Professional Cloud Developer Questions]

You are writing a Compute Engine hosted application in project A that needs to securely authenticate to a Cloud Pub/Sub topic in project B.
What should you do?

  • A. Configure the instances with a service account owned by project B. Add the service account as a Cloud Pub/Sub publisher to project A.
  • B. Configure the instances with a service account owned by project A. Add the service account as a publisher on the topic.
  • C. Configure Application Default Credentials to use the private key of a service account owned by project B. Add the service account as a Cloud Pub/Sub publisher to project A.
  • D. Configure Application Default Credentials to use the private key of a service account owned by project A. Add the service account as a publisher on the topic
Show Suggested Answer Hide Answer
Suggested Answer: B 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
donchick
Highly Voted 3 years, 4 months ago
I vote for B.
upvoted 13 times
...
__rajan__
Most Recent 7 months, 1 week ago
Selected Answer: B
I would go with B.
upvoted 1 times
...
omermahgoub
1 year, 3 months ago
Option B is the correct answer because it involves creating a service account in project A and adding it as a publisher to the Cloud Pub/Sub topic in project B. This allows the Compute Engine instances in project A to authenticate to the Cloud Pub/Sub topic in project B using the service account's credentials. The other options do not involve creating a service account in project A or adding it as a publisher to the Cloud Pub/Sub topic in project B, so they are not valid solutions.
upvoted 1 times
omermahgoub
1 year, 3 months ago
Option C is incorrect because it does not properly authenticate to the Cloud Pub/Sub topic in project B. In this option, Application Default Credentials are being used to authenticate to the topic, but the private key of a service account owned by project B is being used. While the service account may have the necessary permissions to publish messages to the topic, using Application Default Credentials with a private key is not a secure way to authenticate to Cloud Pub/Sub.
upvoted 1 times
...
omermahgoub
1 year, 3 months ago
Option D is incorrect because it does not authenticate to the Cloud Pub/Sub topic in project B. In this option, Application Default Credentials are being used to authenticate to the topic, but the private key of a service account owned by project A is being used. This service account does not have the necessary permissions to publish messages to the topic in project B.
upvoted 1 times
...
omermahgoub
1 year, 3 months ago
Option A is incorrect because it is not a secure way to authenticate to a Cloud Pub/Sub topic in project B. In this option, the instances in project A are using a service account owned by project B, but the service account is not added as a publisher on the topic. This means that the service account does not have the necessary permissions to publish messages to the topic.
upvoted 1 times
...
...
tomato123
1 year, 8 months ago
Selected Answer: B
B is correct
upvoted 2 times
...
JuanitoNN
2 years, 4 months ago
why not D?
upvoted 3 times
akshaychavan7
1 year, 8 months ago
Application Default Credentials would work only if the resource/project has already been set up with the GOOGLE_APPLICATION_CREDENTIALS or the service account key for that project. So, if you were to use the Application Default Credentials then you are assuming that any one of the above two scenarios has already been met. And you can not answer the question based on assumptions!
upvoted 2 times
akshaychavan7
1 year, 8 months ago
Reference - https://cloud.google.com/docs/authentication/production
upvoted 2 times
...
...
...
syu31svc
2 years, 9 months ago
https://cloud.google.com/pubsub/docs/access-control: "For example, suppose a service account in Cloud Project A wants to publish messages to a topic in Cloud Project B. You could accomplish this by granting the service account Edit permission in Cloud Project B" B is the answer
upvoted 2 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago