Google Associate Cloud EngineerDeploying and implementing a cloud solutionMedium

A company is using Cloud Deployment Manager to deploy a complex multi-tier application. They need to ensure that the database instance is fully provisioned and ready before the application servers attempt to connect to it. How can they enforce this dependency in their Deployment Manager template?

  1. AUse a `dependsOn` property in the application server resource configuration, referencing the database instance.
  2. BPlace the database instance and application servers in separate Deployment Manager templates.
  3. CDefine a custom Python script to poll the database status before deploying application servers.
  4. DConfigure a startup script on the application servers to wait for database connectivity.
Show answer & explanation

Correct answer: A. Use a `dependsOn` property in the application server resource configuration, referencing the database instance.

The `dependsOn` property in Cloud Deployment Manager allows you to explicitly define resource dependencies. By setting the application server resource to depend on the database instance resource, Deployment Manager ensures the database is fully provisioned before attempting to create the application servers.

Why the other options are wrong

  • B. Separate templates don't automatically enforce deployment order or dependencies between resources in different templates.
  • C. A custom Python script for polling adds unnecessary complexity and is less declarative than `dependsOn`.
  • D. A startup script addresses application-level readiness but doesn't guarantee the provisioning order of the underlying infrastructure resources by Deployment Manager itself.

Cloud Deployment Manager `dependsOn`

A property used in Cloud Deployment Manager templates to specify that a resource must be created or updated after another specified resource.

  • Ensures proper provisioning order for interdependent resources.
  • Prevents errors from resources attempting to use non-existent dependencies.
  • Can reference other resources within the same template.
  • Is a declarative way to manage resource orchestration.

Memory trick: DependsOn: 'This needs that first' – it's all about ordered building.

More Deploying and implementing a cloud solution questions