In Google Cloud Deployment Manager, a deployment is a single entity that contains all of the defined resources from a given configuration file. A deployment can contain dozens of resources spread across many different services but you only need to manage each deployment as single resource. That is, you can perform updates to the deployment, delete or abandon resources from the deployment, and so on. To create a deployment, you first create a configuration file and then use that configuration file to create a deployment.
This page walks you through creating a simplistic configuration file and using that file to create a deployment.
Before you begin
-
Sign in to your Google account.
If you don't already have one, sign up for a new account.
- Select or create a Cloud Platform project.
- Enable billing for your project.
- Enable the Deployment Manager and Compute Engine APIs.
- Download and authenticate
gcloud. - Set your default project ID. Replace
[MY_PROJECT]with your own project ID:gcloud config set project [MY_PROJECT]
- Be comfortable running commands on a Linux terminal.
Create a configuration
A configuration describes all the resources for a single deployment. A configuration is written in YAML syntax and lists each of the resources in your deployment. A resource can be any resource type defined in the resources list.
- Download the file vm.yaml.
-
Make the file writable. For example, if you are on a Linux machine:
chmod 644 vm.yaml -
Open the file and replace:
- All instances of
[MY_PROJECT]with your project ID [IMAGE_NAME]with the latest image versiondebian-8-jessie-v20160301
- All instances of
This simple configuration file describes a deployment that contains one virtual machine instance with the properties:
- Machine type:
f1-micro - Image:
debian-8-jessie-v20160301 - Zone:
us-central1-f - Root persistent disk:
disk-my-first-deployment - A randomly assigned external IP address
Deploy your configuration
Deploy your configuration:
gcloud deployment-manager deployments create my-first-deployment --config vm.yaml
Wait for the operation to complete. You should see a status message:
Waiting for create operation-1432319707382-516afeb5d00f1-b864f0e7-b7103978...done.
When the deployment is successfully created, you should see a message like:
Create operation operation-1432319707382-516afeb5d00f1-b864f0e7-b7103978 completed successfully. NAME TYPE STATE ERRORS vm-my-first-deployment compute.v1.instance COMPLETED -
Good job, you have your first deployment!
Look up your new deployment
gcloud deployment-manager deployments describe my-first-deployment
You should see a description of the deployment, including its start and end time, the deployment status, and any warnings or errors if applicable:
fingerprint: xmVVeTtPq-5rr8F-vWFlrg== id: '54660732508021769' insertTime: '2016-03-09T04:45:26.032-08:00' manifest: https://www.googleapis.com/deploymentmanager/v2/projects/myproject/global/deployments/my-first-deployment/manifests/manifest-1457527526037 name: my-first-deployment operation: endTime: '2016-03-09T04:46:19.480-08:00' id: '8993923014899639305' kind: deploymentmanager#operation name: operation-1457527525951-52d9d126f4618-f1ca6e72-3404bd3b operationType: insert progress: 100 startTime: '2016-03-09T04:45:27.275-08:00' status: DONE ... resources: NAME TYPE STATE ERRORS vm-my-first-deployment compute.v1.instance COMPLETED -
Check your deployment's manifest
A manifest is a read-only file that describes the deployment's resources in detail. Deployment Manager creates the manifest and logs any errors or warnings that occurred during deployment, which makes the manifest useful for troubleshooting.
To look at your new deployment's manifest:
-
Describe the deployment:
gcloud deployment-manager deployments describe my-first-deployment -
Look for the
manifestfield and copy its value. This is the manifest ID. For example, in this manifest field:... manifest: manifest-1439842033481 ...
The manifest ID is
manifest-1439842033481. -
Use the manifest ID to get the manifest. In the following snippet, replace
manifest-[TIMESTAMP]with your manifest ID:gcloud deployment-manager manifests describe manifest-[TIMESTAMP] --deployment my-first-deployment
Clean up
To avoid incurring charges to your Google Cloud Platform account for the resources used in this quickstart:
gcloud deployment-manager deployments delete my-first-deployment
Type y at the prompt:
The following deployments will be deleted: - my-first-deployment Do you want to continue (y/N)?
The deployment is permanently deleted.
What's next
- Work through the Step-by-Step Guide to Deployment Manager.
- Try some advanced tutorials for Deployment Manager, like the network load balancing tutorial.
- Read more about Deployment Manager Configurations.