Google Deployment Manager: Simplify your Cloud Management

Deployment Manager is an infrastructure deployment service that automates the creation and management of Google Cloud Platform resources like computing, databases, storage and networking. You 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. Management of these cloud environments is done by using an infrastructure-as-a-code approach.

Creating a Configuration file

  1. Create a new Project. I created Deployment Manager Demo as my project.

2. Click on the Activate Cloud Shell icon

3. After logging in, it takes few minutes to provision and connect to the environment. Once connected, you are already authenticated with the project id – deployment-manager-demo-283518 (this being my project id for the demo)

4. Here, we are using gcloud to run all our commands to demonstrate a simple deployment manager demo.

Using gcloud command gcloud auth list, I’ve listed the active account name associated.

Likewise, you can also list down the active project id associated with it using the command: gcloud config list project

References for gcloud: https://cloud.google.com/sdk/docs/cheatsheet

5. We can create a yaml file which will have all the configuration describing for a single document. Hence, created a yaml file with the below command:

6. Added the below configuration in the newly created yaml file and then saved it. You can refer the resources to be added from the link:

https://cloud.google.com/deployment-manager/docs/configuration/supported-resource-types

You can also refer the below link of how to create a configuration file in deployment manager:

https://cloud.google.com/deployment-manager/docs/configuration/create-basic-configuration

The resources used are specified as below:

  • Zone : us-central1-f
  • Machine type : f1-micro
  • Root persistent disk : disk-my-first-deployment
  • Image : debian-9
  • A randomly assigned external IP address

Deploying the Configuration file

For deploying the configuration file, you must execute the below command:

gcloud deployment-manager deployments create my-first-deployment –config deploy-man.yaml

my-first-deployment: name of the instance

deploy-man.yaml: name of the configuration specifying the resources details

After running the command, your deployment will be successful and you will get the below message:

You can verify the newly created instance in Compute Engine — VM Instances

References for creating a deployment:

https://cloud.google.com/deployment-manager/docs/deployments

Viewing the details of the deployment

You can view the information of the deployment by running the below command:

gcloud deployment-manager deployments describe my-first-deployment

You should see a description of your deployment, including its start and end time, the deployment status, and any warnings or errors if applicable.

You will get the below output:

Deployment’s manifest

A manifest is a read-only object that contains the original configuration you provided, including any imported templates, and also contains the fully-expanded resource list, created by Deployment Manager. Each time you update a deployment, Deployment Manager generates a new manifest file to reflect the new state of the deployment. When troubleshooting an issue with a deployment, it is useful to view the manifest.

You can get the manifest of the deployment when you view the deployment details (see above pic). You get manifest-1594964918043 which is actually manifest-<timestamp>

For viewing manifest, you must run the below command for getting the below output:

gcloud deployment-manager manifests describe <manifest-[TIMESTAMP]> –deployment my-first-deployment

Reference for viewing Manifests:

https://cloud.google.com/deployment-manager/docs/deployments/viewing-manifest

Creating instance from a template

You can clone an available Deployment Management (DM) template using the below command.

gsutil cp -r gs://spls/gsp148/create-sql-instance.jinja

Cheatsheet for gsutil: https://alexisperrier.com/gcp/2017/11/02/gsutil-cheatsheet.html

When you cloned the template, you can simply modify instance_name, database_name, region by updating the variables in the template using the variables in the template.

Deploying the configuration which is cloned using the below command:

gcloud deployment-manager deployments create testdep-instance –template create-sql-instance.jinja

Navigate to SQL:

You will find that the SQL instance has been created:

Creating your own DM template

While developing an application, you will most likely require complex architectures. To make your deployment easier to replicate and troubleshoot, we recommend that you break your configuration into templates.

A template is a separate file that defines a set of resources. You can reuse templates across different deployments, which creates consistency across complex deployments.

You can use Python or Jinja2 to create templates for Deployment Manager.

Reference for creating your own template engine:

https://cloud.google.com/deployment-manager/docs/step-by-step-guide/create-a-template

Conclusion

  • Google Cloud Deployment Manager allows you to specify all the resources needed for your application in a declarative format using yaml.
  • Repeatable deployment process by creating configuration files that define the resources, the process of creating those resources can be repeated over and over with consistent results.
  • Declarative approach allows the user to specify what the configuration should be and let the system figure out the steps to take.
  • It is template-driven which means the template allows the use of building blocks to create abstractions or sets of resources that are typically deployed together. Hence, the templates can be used over and over again as these are easily parameterized.

More useful references

Deployment Manager Fundamentals:

https://cloud.google.com/deployment-manager/docs/fundamentals

Reference for Automation Scripts, CICD, Building templates:

https://cloud.google.com/deployment-manager/docs/best-practices

Reference for AWS CloudFormation Vs Google Deployment Manager:

https://cloud.google.com/docs/compare/aws/deployment-tools

6 thoughts on “Google Deployment Manager: Simplify your Cloud Management

  1. Nice article

    Liked by 1 person

  2. Aw, this was a very nice post. In thought I would like to put in writing like this additionally – taking time and actual effort to make an excellent article… however what can I say… I procrastinate alot and by no means seem to get something done.

    Like

  3. I am genuinely thankful to the holder of this web page who has shared this wonderful paragraph at at this place
    about us

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this:
search previous next tag category expand menu location phone mail time cart zoom edit close