Video
Azure Cosmos DB and Pulumi Pulumi 1.0 launch event
Published
A talk from the Pulumi 1.0 launch event, presented by Mikhail Shilkov, Microsoft Azure MVP.
Show video transcript
So now I want is our greatest database of all time and then show in just 15 minutes how we can use it to actually build the application in Asia, globally distribute it and using all the power of customers. And of course, so I will start simple. Let’s say I’m developing a service and a micro service and a ecommerce application. I want to show a product on a web page or something like that. And I started simple. I only have two components in my education at the moment. One is and one is as functions which is a service in Asia. And for starters, I just deployed to one region here in the US I use for this. So that’s how my typescript program can look like I start with the resource group which is the name, it’s like a container for resources in measure. And then the location of that resource group is going to be defined by the configuration of my staff. So I can to deploy me for reasons if I want to. And then I have a resource component for cosmos. And the important bit here is how I can figure locations, you can see based on the name, the locations that it could be in a but for now, I just use 11 location I deploy somewhere in the US. And then I need to define as a function for my app. And I chose to use a component called subscription. And the cool thing about this component is that they can define the code of my application right inside my poly program. So I just type javascript function. I do whatever I want and polo will take care of package it as Asia expects it, deploy it to Asia, I can figure my application exactly the way Asia wants it to be. And I just read jaws can function voice our response and do whatever I want there. So another cool thing there is like in the body of that punch, I can just use a variable customer account that I just define the improvement slide and use it as a just any other job could variable I can keys from my connections to just out of there without taking much care. And Colombia will be smart enough to start deploying with customers and getting the keys from that customer account pass to my function package. It is a zip file, put it on someone’s storage and then load any function up to use the zip file. Hold on for me, I just write the function. So this is my first question application. I want to wait several minutes. I get to resource group cos account and then several resources which are required to run in the function of storage account, zip file consumption plan itself. So right now I can write my public page works and I’m sitting here in the US. I’m a happy user. I sit close to the application so I’ll get the best possible experience. But my e-commerce side is global. So I have customers in Europe. I have customers in Asia from those locations. It’s not going to be that great. Like from San Francisco might get 100 milliseconds. But from Europe, from Germany or Hong Kong, I get like 400 milliseconds. If I have multiple subsequent requests, it starts to build up and I get basically worst experience for, for the outside world. That’s not what I want because I want my customers to be happy. So let’s make the distribution is the application distributed. So I started with and I will not be clicking the portal to make it distributed. I’ll just change my program. I make an extra configuration which list all the locations where I want it to be. And then with typescript tran value, I create Jan area with the other thing I need to do is to map this area into an area of objects which will be compatible to the Cosmos account resource. That’s again, just one call to touch map function. So I do that I ramp up again, but it doesn’t help of course, because my customer still talks to function app, it doesn’t talk to my customers directly. So it still makes a round trip to the US and then US function app talks to customers. Well, it seems to be a real mistake. But when your infrastructure is being, when co managed by one team and managed by other team, it’s quite easy to make this mistake and production application. So let’s see how we can fix it. Instead, I want to deploy function app every region, the same reasons that I deployed cos and then I want to configure routes and so use them from as around to the closed location, use it from Europe to the coast location U and so on. So I can take so many reasons. I want, I just need the infrastructure and make it front and round and make, choose the better one. So my plan for the second iteration of my app, I have to be on the back end which takes care of the hard stuff of the distribution, the data and then I copy my function at 10 times and I put as your traffic manager which is like the space service in Asia in front of it and I crowded based on the nearest location in terms of the change. So I need to change function app. Now I just have a look, I look through locations and for every location, I create 11 subscription subscription is gonna be exactly the same except that it’s in a different location and then it connects to a different region for the cosmos. And in the end I get an end point and I need to use this end point to configure the traffic manager trying to find the profile which is like global thing which has the last name and write another. And then again, I have a loot which goes through the same location area face an endpoint and the traffic manager and then that links this end point to the proper function just by using the idea of the resource. And that’s it. When I deploy the problem is fixed, the late are good for just where my customers are. That’s not the end. I go to my other team and say, I explain what I need and they say, yeah, we need exactly this but we don’t use as functions for this. Let’s say the shopping cart service is using go and then they package it is a doer and put somewhere and as you can. But they want the rest of my application to work the same. They still want to be global, they still want to use Cosmos. Maybe my price team has like a million of Java. The application on Iran is in one specific version of operating system. So they have to deploy it on virtual machines and they put it on a bell in front all the network and security that’s already hard enough. But now they have to make it global. It’s quite easy to make a mistake. So how can I help them? Well, I can notice that there is a there for customers to me. I have a front with traffic manager and then I have some computer which does stuff in their room and provides a big part. So they should connect to me so I can make an abstraction. And as I would do it with normal generic purpose, the language I can create a component for this. So I can create a component which is called it’s a really simple one, I can pass a resource group, a list of locations and then like come back function to provision the customer services for the use case. So the go back will do two things, some global resources specific for the use case. And then for every reason, a copy of things start. So I explain, I’ll give an example for my fun happiest case. I don’t need any global infrastructure. I just to go back again. So instead of going myself, I delegate is the component and I just for trades in one location are I guess it’s not available but I have two blocks here. One great Asian container results registry makes the image, put this document in the container registry. I can still do everything my program and then I have a call back which again uses the javascript closes to use that container register. One cost has to be to create Asian container instances and configure it properly, to connect with the right region, then use the open and then it just returns against my component has to know. And for my pricing team, they create all the infrastructure which I but if you consider it’s like a dozen of resources just today, it’s still, it’s much easier than if they had to do it themselves on a global and distributed. So a couple of benefits that I get from this, I can also evolve this component separately from my end users. So let’s say al right, distribution for my product service because products they are not changed by, by, by end users. But then my shopping cart team asks, I just pay the next option and I can distribute the new version of the application of component of the line and then everybody can benefit from it. And let’s say I want to swap traffic manager with like another service and as a, as a front door which is like a city and they have locations around the world and then they get into traffic through Asia networks. So it might be faster for my space. So I just swap from one service with the other inside the component and make a new version. And then everybody can, who wants to use it can just update their packages and need it. Basically don’t have to think about this that much. So perfect. So we looked at the power of cosmos to be to solve the hard problems of the students and data around the world. And we can, but it’s still not to create applications which we can globally distributed that would embrace this power of the first time. So we can use first touch code to this configuration properly written once and that is still doing multiple teams. And we can also create extractions which will qualify some best practices in life. So what everyone have to think of them just sharing with the community. So if you want to know more, there is a block post which outlines this a little bit. There is a component of my which does exactly this and then if you want to start with, there is real. So thank you. I think we are done and good for beers.