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 103 discussion

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

You want to create `fully baked` or `golden` Compute Engine images for your application. You need to bootstrap your application to connect to the appropriate database according to the environment the application is running on (test, staging, production). What should you do?

  • A. Embed the appropriate database connection string in the image. Create a different image for each environment.
  • B. When creating the Compute Engine instance, add a tag with the name of the database to be connected. In your application, query the Compute Engine API to pull the tags for the current instance, and use the tag to construct the appropriate database connection string.
  • C. When creating the Compute Engine instance, create a metadata item with a key of ג€DATABASEג€ and a value for the appropriate database connection string. In your application, read the ג€DATABASEג€ environment variable, and use the value to connect to the appropriate database.
  • D. When creating the Compute Engine instance, create a metadata item with a key of ג€DATABASEג€ and a value for the appropriate database connection string. In your application, query the metadata server for the ג€DATABASEג€ value, and use the value to connect to the appropriate database.
Show Suggested Answer Hide Answer
Suggested Answer: D 🗳️

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
HotSpa27
Highly Voted 1 year, 11 months ago
I vote D. https://cloud.google.com/compute/docs/metadata/querying-metadata
upvoted 7 times
...
omermahgoub
Most Recent 11 months, 2 weeks ago
D. When creating the Compute Engine instance, create a metadata item with a key of "DATABASE" and a value for the appropriate database connection string. In your application, query the metadata server for the "DATABASE" value, and use the value to connect to the appropriate database. This approach allows you to create a single golden image that is agnostic to the environment it is running in, while still allowing the appropriate database connection to be set at runtime. The metadata item is stored with the instance, so it can be read by your application at any time. This method allows you to avoid creating different images for different environments, and to use the same image for all environments. You can create metadata item by using the gcloud command line tool or the API to set metadata for a Compute Engine instance. Once set, the metadata can be easily accessed by your application via the instance metadata server.
upvoted 1 times
...
zellck
12 months ago
Selected Answer: D
D is the answer. https://cloud.google.com/compute/docs/metadata/setting-custom-metadata
upvoted 1 times
...
tomato123
1 year, 4 months ago
Selected Answer: D
D is correct
upvoted 2 times
...
akshaychavan7
1 year, 4 months ago
Selected Answer: D
It should be D!
upvoted 1 times
...
GCPCloudArchitectUser
1 year, 9 months ago
Selected Answer: D
Thanks HotSpa27 it is indeed D Every VM stores its metadata on a metadata server. Use these instructions to query these metadata values. You can only query the metadata server programmatically from within a VM
upvoted 3 times
...
JonathanSJ
1 year, 11 months ago
D: https://cloud.google.com/compute/docs/metadata/overview
upvoted 3 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 ...