What is Deployment Manager?
What is Deployment Manager?
Deployment Manager is an infrastructure deployment service that automates the creation and management of Google Cloud Platform resources for you. We can write flexible template and configuration files and use them to create deployments that have a variety of Cloud Platform services, such as Google Cloud Storage, Google Compute Engine, and Google Cloud SQL configured to work together.
Setting up all the cloud resources for your application can be a daunting task. Once you decide what you need, you want the process for creating them to be easy, repeatable and controlled. This is particularly important if you have multiple developers or administrators that need to set up copies or variations of the same 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. The templates support jinja or python, so you can take advantage of programming constructs such as loops, conditionals, and parameterized inputs for deployments requiring logic. Here is the list of the resources you can launch through the deployment manager. The YAML file must consist following three components:
- name:
A user-defined string to identify this resource such as tudip-instance, my-disk, my-vpc. - type:
The type of resource being deployed such as compute.v1.instance, compute.v1.disk. - properties:
The parameters for this resource type. They must match the properties for the type such as zone: asia-east1-a, boot: true.
Let’s dive in with an example
In this, we will see how to create a Compute Engine instance using Deployment Manager. The Compute Engine will be having the following configuration
- Zone: us-central1-f
- Machine type: f1-micro
- Image: debian-9
The YAML file named vm.yaml for this deployment will look like this:
resources:
- type: compute.v1.instance
- name: tudip-instance
properties:
- zone: us-central1-f
- machineType: https://www.googleapis.com/compute/v1/projects/[PROJECT_ID]/zones/us-central1-f/machineTypes/f1-micro
disks:
- deviceName: boot
- type: PERSISTENT
- boot: true
- autoDelete: true
initializeParams:
- sourceImage: https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/family/debian-9
networkInterfaces:
- network: https://www.googleapis.com/compute/v1/projects/[PROJECT_ID]/global/networks/default
# Access Config required to give the instance a public IP address
accessConfigs:
- name: External NAT
- type: ONE_TO_ONE_NAT
Now, that the config file is ready we can create a Compute Engine using the following command:
gcloud deployment-manager deployments create tudip-deployment --config vm.yaml
Here, we can see the tudip-instance is being created using the Deployment Manager.
In order to get the details of the deployment, we can use the following command.
gcloud deployment-manager deployments describe tudip-deployment
We can create a lot more things using Deployment Manager like database, App Engine, etc.