Deploying Your Resources

Now that you have a configuration, you can use it to create a deployment. Your new deployment will have all the resources defined in the configuration; in this case, your deployment will have two virtual machine instances.

To deploy your configuration, run this command:

gcloud deployment-manager deployments create deployment-with-2-vms --config two-vms.yaml

Wait for the operation to complete to indicate that the deployment was created successfully (note that your actual operation IDs will differ):

Waiting for create operation-1432319707382-516afeb5d00f1-b864f0e7-b7103978...done.
Create operation operation-1432319707382-516afeb5d00f1-b864f0e7-b7103978 completed successfully.
NAME           TYPE                 STATE      ERRORS  INTENT
the-first-vm   compute.v1.instance  COMPLETED  []
the-second-vm  compute.v1.instance  COMPLETED  []

You have created a deployment! If you want to see your new deployment, run the following command, which lists each of the resources in your deployment, along with the resource type, unique resource ID, resource name, and the resource creation status:

gcloud deployment-manager deployments describe deployment-with-2-vms

Also, you can see a deployment’s manifest, which is a read-only Deployment Manager-created file that shows the original configuration input and the expanded configuration of a deployment. During the course of your application development, you might want to view the manifest for troubleshooting or to remind yourself what resources a deployment contains.

To get the manifest:

  1. Describe the deployment:

    gcloud deployment-manager deployments describe deployment-with-2-vms
    
  2. Look for the manifest field and take the value manifest-TIMESTAMP. This is the manifest ID. For example:

    ...
    manifest: manifest-1895416789469
    ...
    
  3. Use the manifest ID to get the manifest, replacing the manifest ID in this example with your own manifest ID:

    gcloud deployment-manager manifests describe manifest-1895416789469 \
      --deployment deployment-with-2-vms
    

Viewing resources of a deployment

A manifest describes your configuration but doesn't give you a list of resources in the deployment or the current resource state. This information is useful because if a deployment fails, you can quickly see which resource might be causing the issue.

To get a list of deployment resources, run:

gcloud deployment-manager resources list --deployment deployment-with-2-vms

In this example, you created some static configurations that were hard-coded. In future configurations, you might want to create more dynamic configurations using variables and reusable templates. Follow the rest of this guide to learn how to make this static configuration much more dynamic and useful.

View your deployment in the GCP Console interface

You can also view an expanded list of all your deployments in the Google Cloud Platform Console, Google Cloud Platform's graphical interface. To do so:

  1. Go to the Deployments page in the GCP Console.
  2. Expand your deployment to see the associated resources.

    Screenshot of expanded deployments

You can always come back here to see your deployments in a visual tree. In later examples of this guide that are more complicated, this page can help you understand the hierarchy of resources in your deployment.

Delete Your Deployment

Compute Engine resources incur charges, so you should delete this deployment, as it is no longer necessary for future steps. Deleting this deployment deletes all the resources in this deployment as well. If you don’t delete the deployment, you will run into conflicts with future examples.

To delete this deployment:

gcloud deployment-manager deployments delete deployment-with-2-vms

Next: Using References

Related topics

Var denne siden nyttig? Si fra hva du synes:

Send tilbakemelding om ...

Cloud Deployment Manager Documentation