GOOGLE-PROFESSIONAL-CLOUD-DEVELOPER practice question 24 of 35
Your application is built as a custom machine image. You have multiple unique deployments of the machine image. Each deployment is a separate managed…
Full set: 265 questionsInstance metadata is the standard, out-of-the-box Compute Engine feature for providing configuration data to virtual machine instances. Since each deployment uses a unique instance template, you can define a unique set of key-value pairs as custom metadata within each template. The application running on the instance, which is created from the common custom image, can then query the metadata server at runtime to retrieve its specific configuration values. This approach cleanly separates the configuration from the application image, satisfying all requirements of the scenario.
A. Persistent disks are for block storage, not for injecting configuration values. This method is inefficient and overly complex for passing configuration data.
B. Cloud Bigtable is an external database service. While it can store configuration, it is not a core feature of Compute Engine for instance configuration and adds unnecessary external dependencies.
C. A startup script is used for running commands at boot time. While it could contain configuration values, the best practice is to store the values in metadata and use the script to read and apply them. ---
1. Google Cloud Documentation - Storing and retrieving instance metadata: "Use the metadata server to access information about your instance programmatically, such as the instance's host name, instance ID, startup scripts, and custom metadata... For example, you can write a startup script that gets a metadata key-value pair and uses that value to configure your application." This confirms metadata is the intended mechanism for providing configuration values that can be used by scripts or applications.
Source: Google Cloud > Compute Engine > Documentation > Metadata > Storing and retrieving instance metadata.
2. Google Cloud Documentation - Instance templates: "An instance template is a resource that you can use to create VM instances and managed instance groups (MIGs)... An instance template includes... other instance properties like metadata and startup scripts." This confirms that metadata is a property of the instance template, allowing for unique metadata per template.
Source: Google Cloud > Compute Engine > Documentation > Instance groups > Instance templates.
3. Google Cloud Documentation - Passing metadata to VMs: "You can pass custom metadata to your project or instance... For example, you could create an instance and set a custom metadata value of startup-script-url to specify the location of a startup script." This illustrates the direct use of metadata for configuration.
Source: Google Cloud > Compute Engine > Documentation > VM instances > Creating and starting a VM instance > Passing metadata to VMs.
Keep practicing
Take the free GOOGLE-PROFESSIONAL-CLOUD-DEVELOPER practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other GOOGLE-PROFESSIONAL-CLOUD-DEVELOPER practice questions
- Question 1You have an application controlled by a managed instance group. When you deploy a new ver…
- Question 2Your service adds text to images that it reads from Cloud Storage. During busy times of t…
- Question 3You have been tasked with planning the migration of your company’s application from on-pr…
- Question 4You plan to make a simple HTML application available on the internet. This site keeps inf…
- Question 5HipLocal's APIs are showing occasional failures, but they cannot find a pattern. They wan…
- Question 6Your company has created an application that uploads a report to a Cloud Storage bucket. …
