Google Cloud Deployment Manager - Getting Started

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments

I would be curious to see how many people actually use Deployment Manager. IMHO compared to Terraform it is slow, buggy, not very well supported, and lacks many basic features to do basic things inside of GCP.

👍︎︎ 2 👤︎︎ u/khirok 📅︎︎ Aug 28 2020 🗫︎ replies
Captions
hey what's up guys jk here so in this video i'm gonna discuss about the cloud deployment manager it's an infrastructure automation tool or rather a service from google cloud so if you want to skip the introduction and go into the demo go to the below timeline and you can see the demo starting from there so for those who are new to this whole concept of infrastructure as a code uh stick around till end of this video because you're going to get some important tips and so what is this all about for people who are new to this whole concept so deployment manager is an offering from google cloud so it's pretty much like your same offering from aws if you know aws it is called cloudformation and if you are aware of terraform if you have if you're not aware of terraform go back to my previous video one of the video and like i have explained about terraform so terraform is like a cloud agnostic solution uh where using terraform you can deploy to multiple clouds like you can deploy to azure it has multiple providers so you can deploy to all those cloud service providers so deployment manager is only for google cloud and it is pretty much similar to the cloudformation template but there are certain certain variations and i think cloudformation is much more mature because it started it is a very old tool and i'm gonna go through when i'm going through the code and stuff but the main important point is it is an infrastructure as a code offering meaning that so you're going to combine your whole infrastructure as part of the code if you looked at my previous videos i used to create compute engine i have created i've created uh buckets or i've created cloud functions so whenever i have created those resources i created using either gcloud or using console and so often what happens is like you know i create them and i forget them so it is not a repeatable process meaning you know it's an ad hoc basis of creating the resources but if you want to make it more like your whole infrastructure to be coded meaning that you know you want to create the infrastructure right from dev and you want to create the same infrastructure to the qa or to pre-broad or production or you want to codify your infrastructure based on the different deployments based on the different environments so that's when these infrastructure as a core tools shine and they help you a lot so one of the important concept here is it considers the whole deployment as a unit so the deployment is a unit here for example in aws you call it as a cloud formation stack so stack is like you know once you create the template the stack will have all the resources together so here deployment is a unit that will have all your resources together so you can combine multiple resources in a in a file and then you can deploy that file and you can deploy all the resources so that file is called the configuration file with a group of resources and this tool also has the service also supports python by having a templatized version by creating templates the reason why you want to use templates is if you have a common component that you would like to use in the configuration so you have the main configuration and you also have the common ser or the common modules that you would like to use in your configuration across different configuration files so that's when you would use uh templates and template supports uh jinja 2 and python so let's look at how the configuration file typically looks like so a configuration file must have resource so if anybody would ask you an interview uh you know this is a commentary question in aws as well like you know people would ask so what is the main section without which your confirmation will not work which is called the resources section right so it's similar to that here as well so in the deployment manager you should have the resource and each resource must have three components so one component is name it's a user defined string for example if you want to create a gcs bucket you would give the name of the gcs bucket here and the type so the type is like what type of resource is that is it a computer source is it a gcs bucket resource or the cloud function or bigquery or whatever resource that is and then the properties so the properties would carry all the important parameters that are required for that resource type for example whenever you're creating a compute engine you need to give the zone if you don't give the zone you cannot create that so that's a mandatory parameter so all those parameters are part of these properties i'm going to show you what exactly like how you would choose the parameters or you know what what are the name specific names that you have to give because you cannot give any name as per your wish right you have to specifically define the parameter which is well documented in the api documentation of google cloud which i'm going to show you here so the other important thing to understand here is that deployment manager doesn't support all the resources by default and this is the same with aws or azure or any you know any any cloud size provider because what happens is whenever a new service is launched in in cloud so it's not mandatory that you know the service would be supported by multiple other services meaning if if cloud deployment managed the service here so that would not support that other new service like if i have to take specific example i haven't seen the cloud deployment manager supporting dialog flow delay flow is a machine learning service in google cloud so that that's important thing to understand and if you want to look at what are the important services or what are the services that this deployment manager service would support you're going to click on this link and it will show you all the resource types that it supports so now let's look at the sample configuration file maybe i'll show it in here so this is a sample configuration file and i'm going to create two resources so one resource is bucket and the other resource is a compute engine compute instance the reason why i wanted to do this was like i want to mix up two different services and i want to combine them into one configuration file and now if you see the main section here the resources so here we're going to define all the resources and the first resource i'm defining here is sample gcs123 which is the bucket name and the type is storage.v1.bucket again you're going to get this from the documentation this has to be exactly as it is based on the version let's say tomorrow they would launch a v2 version then you would put v2 here so start with it starts with the service and the version and the bucket now the properties are with respect to the storage the properties here is storage class and i'm going to create a standard version so it's going to be standard now the second resource i'm creating here is a compute engine so i'm going to name the compute i'm going to name my vm computing resource as a sample vm and the type here is again compute dot v1 dot instance so the properties that are required for the compute engine are like zone which is important and the machine type obviously without machine type you cannot you cannot create a you cannot create the instance and one weird thing which i did not like about deployment manager is that since i've used cloudformation extensively in cloudformation you can just give the machine type as you know specific id uh getting it from the console but here you have to give the whole url here that's a sort of a weird thing but anyway so this url will accompany uh the project id here which have changed it to the actual project id so you would change it to you would change it to your project id and then you will give this and the device is importance of the device and what type of device is that so boot true and auto delete like if you already delete in the instance you know you want to delete you want to delete the the device as well if you don't do that the device will be there and you have to pay for that the source image as well here you can you can select the list of sources in the list of images that that are there in the console and you can get that or you can also go through the documentation like if i have to show you that real quick so here this shows the supported resource types and if you see all the resources are here which are supported by deployment manager if i go to compute um here we're using instance right so v1 instance we're not using beta so here when you click on the documentation you can see all the properties that you can use for that resource type and here we want to look at the image so i can search by image in this api documentation it will it will tell you exactly how you can use that image and stuff and there are queries as well you know you can search in google to get specifically the url that you want to use like self link url right okay so that's the source image and the network interfaces obviously you have to use a network interface i'm using it default and then it's going to be accessible through internet so it's external ad so that's with respect to the configuration it looks quite simple so i highly recommend you all to start practicing with this and play around with this so that you know uh it will be helpful for you not only to create resources but also to delete the resources so that you don't lose one or two resources there and unnecessarily pay the cost so the other important thing about deployment manager is you have to at least start with the basics and go little deeper because it's heavily asked in the devops certification of google cloud i've looked at the contents and i see lot of questions in through the practice questions at least that they are asking a bit of deployment manager so now i'm going to copy this whole code and go to my console so click on activate cloud shell and if you see the small icon that you see here on the right side the important button that you would like to see here is the open editor so click on that and open it in a new window so that it will be easy for you to manipulate the code so i have copied the whole code here which i call it as a config cloud config.yml and by the way this is all the eml configuration so the configuration file supports support cml and if you see here i can directly open it in the editor and i can change the resources or i can do anything from here itself that that's the best part of this whole developer experience in google cloud now the next thing is we want to use this to deploy our resources right we want to create the resources so for that the first thing that we want to do is we want to do gcloud config set project and i want to get the project name from here project id copy this is my bed copy paste it all right now we have set the project the next thing is i want to make sure if this file is existing here ls cloud config.yml the file is existing so the command is very simple again cloud deployment manager deployments create copy this i'm going to explain you all here oops my bad all right so the command is gcloud deployment manager which is a service deployments we want to create a new deployment here which is a unit and create this is the deployment name the config is going to be the actual configuration file which is cloud config dot ml as you can see here so that's that's the file name and enter so here when when it is going on what we can do is we can go to the cloud deployment manager and look at what's happening here and if you see any errors you would see right over here itself okay so it is trying to deploy the compute gcs which is a storage bucket i think it might have created that we'll also look at that and then now it is trying to create the vm here all right so it created two resources sample gcs123 and compute engine perfect as you can see the deployment is completed and this is the deployment deployment name now if i go to the cloud storage as you can see the bucket is created and go to compute engine it is a bit slow okay we can see the compute engine got created perfect now if i run this command again you guys are going to tell me what's going to happen so if i run this command again i'm going to pause here and you tell me you just based on your analytical skills what do you think should i really happen if i run this command again all right paste that in the comment section while i'm running this [Music] obviously so what what's happening here is that it says that you know the deployment name is already existing so you cannot create the same deployment unit so it has to be unique so that's important so now if you want to do an update you can do an update and again you can take that as an assignment and you know you can change the bucket name or you can change the resource types and try to do a deployment update instead of deleting the deployment unit again and creating a new deployment and also if you want to play around with templates feel free to do that so now in the deployment manager if i delete this instance so it's going to ask me delete compute gcs and all resources created by it so what it's asking me is like you know if you deli if you delete this deployment do you want it to delete all the resources that got created with this or do you want to just keep the resources but just delete the deployment unit so that can be done as well and this is the same behavior in in adw2 but i want to delete all the resources so i can either do this or the command using gcloud is same as the same as a as create delete and the name of the deployment which is compute gcs yes so here we can see that there is something that's happening here which is with respect to delete so while this is happening if you want to differentiate between this and terraform and if you haven't watched my terraform video please feel free to watch that because even terraform is commonly asked i think terraform is also part of the devops professional certification so the difference which i see here is like you know here in this case at least you don't have to maintain the state or you have don't have to maintain the state file or you know worry about that uh because google google is taking care of your state and everything for with respect to their deployment whereas in terraform you have to make sure that the state is the state file especially that is getting created whenever you create a resource is saved somewhere so that it's not corrupted if you want to restore or do all that stuff so that that's the difference and it's always easy to work with deployment manager inside the google cloud but again the question if if they would ask you in the professional architect exam or in in the in the devops exam with respect to how would you manage multiple you know resources or multiple clouds then that's when you would you know i would ideally say terraform when compared to deployment manager all right so the so the resources got deleted and i think i have covered pretty much everything that i wanted to cover yep all right folks that's it for this video and let me know in the comment section if you have any questions or if you have any issues with this and practice at home and you know try it out with the new service so that would cover most of your google not certifications if they're asking this tool or the service and thank you so much for watching stay safe take care bye you
Info
Channel: Cloud Advocate
Views: 6,411
Rating: undefined out of 5
Keywords: Google Cloud, Cloud Computing, Cloud Technologies, GCP exam, Google Associate exam, Cloud Engineer, Cloud Career tips, cloud advocate, cloud deployment manager gcp, deployment manager google cloud, deployment manager gcp, infrastructure as code, deployment manager, google cloud tutorial, google cloud platform
Id: qVKp7W1bfrE
Channel Id: undefined
Length: 18min 31sec (1111 seconds)
Published: Fri Aug 28 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.