WEBVTT 0:00:02.720000 --> 0:00:09.700000 In this topic, we're going to take a look at Azure Container Instances. 0:00:09.700000 --> 0:00:13.380000 We're going to cover the following topics. 0:00:13.380000 --> 0:00:18.540000 We're going to look at what Azure Container Instances are, and we're going 0:00:18.540000 --> 0:00:23.600000 to take a look at a demonstration of how you can use Azure Container Instances. 0:00:23.600000 --> 0:00:29.520000 I want to start out just with a quick whiteboard to talk about the spectrum 0:00:29.520000 --> 0:00:34.560000 of container support within the Azure environment. 0:00:34.560000 --> 0:00:38.120000 We have all these different ways of supporting containers. 0:00:38.120000 --> 0:00:43.120000 If you think about it on one end of the spectrum, we've got virtual machines. 0:00:43.120000 --> 0:00:55.180000 I can have a virtual machine, and I could install on my own Docker onto 0:00:55.180000 --> 0:01:03.500000 that virtual machine, and then I could of course run my containers on 0:01:03.500000 --> 0:01:06.020000 top of that, and I won't label them and take your time, but I've got my 0:01:06.020000 --> 0:01:07.440000 containers up there. 0:01:07.440000 --> 0:01:11.920000 But at this point, I am responsible really for this entire suite. 0:01:11.920000 --> 0:01:15.000000 Obviously, not the hardware, but the virtual machine, the operating system, 0:01:15.000000 --> 0:01:16.820000 the Docker, etc. 0:01:16.820000 --> 0:01:20.140000 Then if I wanted to cluster that, it would get a bit more complex. 0:01:20.140000 --> 0:01:21.820000 Then we have other solutions. 0:01:21.820000 --> 0:01:26.120000 For example, we've got Kubernetes, which is a clustering solution. 0:01:26.120000 --> 0:01:34.840000 I can also go with Web App. 0:01:34.840000 --> 0:01:40.500000 I can go with the Azure service fabric. 0:01:40.500000 --> 0:01:45.520000 I have all of these solutions that are in and of themselves platform solutions, 0:01:45.520000 --> 0:01:48.780000 but I still have to do some configuration. 0:01:48.780000 --> 0:01:54.180000 Then over on the other end of the spectrum, we have Azure Container Instances, 0:01:54.180000 --> 0:01:58.920000 or ACI. I'm going to type out ACI because that's less typing. 0:01:58.920000 --> 0:02:05.740000 With ACI, what you're going to do is you're simply going to define a container 0:02:05.740000 --> 0:02:08.540000 that you want to run based on an image. 0:02:08.540000 --> 0:02:13.800000 A little bit of setup for that, but that's it. 0:02:13.800000 --> 0:02:17.100000 I say, look, I have this one container I need to run. 0:02:17.100000 --> 0:02:18.120000 I just want to go ahead and run it. 0:02:18.120000 --> 0:02:23.320000 I want really the least amount of administrative overhead. 0:02:23.320000 --> 0:02:25.600000 Let me go ahead and work with an ACI. 0:02:25.600000 --> 0:02:29.300000 ACIs have some interesting characteristics. 0:02:29.300000 --> 0:02:31.440000 They are billed by the second. 0:02:31.440000 --> 0:02:37.060000 You can define the resources that you want to dedicate to a particular 0:02:37.060000 --> 0:02:40.840000 container, which are processor resource, which are memory resource that 0:02:40.840000 --> 0:02:43.800000 you want to dedicate to that. 0:02:43.800000 --> 0:02:49.700000 They're designed so that they potentially can be spun up, and then also 0:02:49.700000 --> 0:02:53.420000 spun back down to really minimize cost. 0:02:53.420000 --> 0:02:57.280000 One of the things that's pretty cool is that you can actually configure, 0:02:57.280000 --> 0:03:02.540000 if you've got Azure Kubernetes services, you can configure Azure Kubernetes 0:03:02.540000 --> 0:03:07.020000 services to use Container Instances. 0:03:07.020000 --> 0:03:12.100000 If your load on your Kubernetes service gets too high, it can spawn off 0:03:12.100000 --> 0:03:16.980000 some instances, run those until the load comes back down on your AKS, 0:03:16.980000 --> 0:03:18.720000 and it can just drop off those instances. 0:03:18.720000 --> 0:03:24.000000 Really interesting options that you get, and that's actually again, a 0:03:24.000000 --> 0:03:27.600000 feature of Kubernetes itself. 0:03:27.600000 --> 0:03:30.460000 That's the idea of ACI. 0:03:30.460000 --> 0:03:36.880000 It's just this easiest way to really manage your containers to deploy 0:03:36.880000 --> 0:03:38.400000 and manage your containers. 0:03:38.400000 --> 0:03:43.640000 Let's take a look at some of the concepts within ACI. 0:03:43.640000 --> 0:03:47.700000 First of all, it's a simple container hosting solution. 0:03:47.700000 --> 0:03:53.360000 It includes port mapping, and one of the advantages of ACI over say using 0:03:53.360000 --> 0:03:57.460000 a web app, a web app is also a very easy way to host containers, but with 0:03:57.460000 --> 0:04:01.100000 a web app you are limited in the ports that you can expose, and the protocols 0:04:01.100000 --> 0:04:02.060000 that you can expose. 0:04:02.060000 --> 0:04:05.000000 Here, it's really just saying, what ports do you need access to, and then 0:04:05.000000 --> 0:04:07.300000 it's up to the container to deal with that. 0:04:07.300000 --> 0:04:10.940000 You have the ability to mount file shares also to mount storage. 0:04:10.940000 --> 0:04:15.020000 As I mentioned, they are charged by the second. 0:04:15.020000 --> 0:04:17.420000 What are some use cases for this? 0:04:17.420000 --> 0:04:21.580000 As I mentioned, you can have single container solutions. 0:04:21.580000 --> 0:04:23.560000 I just have a service. 0:04:23.560000 --> 0:04:25.460000 I've had this service forever. 0:04:25.460000 --> 0:04:28.280000 We wrapped it up in a container, we just wanted to go and run on its own, 0:04:28.280000 --> 0:04:33.880000 we can do that. That's any simple service, automation processes. 0:04:33.880000 --> 0:04:38.660000 Maybe I've got an automation process where I'm pulling in a large amount 0:04:38.660000 --> 0:04:41.100000 of data, and I want to automatically process that. 0:04:41.100000 --> 0:04:44.960000 Well, I could spin up containers, process it via the container, and then 0:04:44.960000 --> 0:04:49.520000 spin them back down and deallocate them when they're done. 0:04:49.520000 --> 0:04:52.780000 And basically, if you have these processes that have a short lifestyle, 0:04:52.780000 --> 0:04:57.040000 because of the way that container instances are provisioned, and the way 0:04:57.040000 --> 0:05:02.920000 that they are billed, it can be very advantageous to use container instances 0:05:02.920000 --> 0:05:06.860000 for those. If you already have another solution, if you're already running 0:05:06.860000 --> 0:05:11.320000 AKS, and you've got the bandwidth, this may not be something you need, 0:05:11.320000 --> 0:05:13.120000 it's just one of those options. 0:05:13.120000 --> 0:05:19.560000 Let's take a look at how we can set up an Azure Container Instance solution. 0:05:19.560000 --> 0:05:25.260000 I'm gonna go ahead and pop into Azure. 0:05:25.260000 --> 0:05:29.900000 And within Azure, I am going to create a resource. 0:05:29.900000 --> 0:05:37.400000 And I'm gonna create a Container Instance. 0:05:37.400000 --> 0:05:42.560000 Now, obviously, this can be created from the command line as well. 0:05:42.560000 --> 0:05:44.740000 Let's do it nice and visually here. 0:05:44.740000 --> 0:05:47.380000 Put it in a resource group. 0:05:47.380000 --> 0:05:50.940000 Now, the container name doesn't have any kind of DNS suffix, so it doesn't 0:05:50.940000 --> 0:05:56.460000 need to be globally unique, but it obviously should be well-named. 0:05:56.460000 --> 0:06:02.700000 That name works for me. 0:06:02.700000 --> 0:06:04.240000 Oh, oh, only lowercase letters. 0:06:04.240000 --> 0:06:06.160000 No, apparently that name doesn't work for me. 0:06:06.160000 --> 0:06:12.260000 We'll go CI. And, AZ, there we go. 0:06:12.260000 --> 0:06:13.780000 Really, I didn't make a mistake there. 0:06:13.780000 --> 0:06:17.940000 I just wanted to show you that it does validity checking while you're 0:06:17.940000 --> 0:06:19.420000 going, that was it. 0:06:19.420000 --> 0:06:21.680000 Now, the next thing is image type. 0:06:21.680000 --> 0:06:26.140000 So if it's a public image, for example, if it's in Docker Hub, then I 0:06:26.140000 --> 0:06:27.840000 can just specify that. 0:06:27.840000 --> 0:06:29.980000 But this is a private image. 0:06:29.980000 --> 0:06:35.420000 When I select private image, I get more data that I need to supply. 0:06:35.420000 --> 0:06:40.320000 Now, fortunately for me, I should remember this before I started demoing, 0:06:40.320000 --> 0:06:44.000000 and I've got that information right here. 0:06:44.000000 --> 0:06:48.720000 So it's asking me for the image name, and that's the image name that I 0:06:48.720000 --> 0:06:56.900000 wanna run. And then it's asking me for the login server, and that's my 0:06:56.900000 --> 0:07:04.940000 login server. And then it wants to use our name. 0:07:04.940000 --> 0:07:07.480000 Got that too, as it turns out. 0:07:07.480000 --> 0:07:16.180000 And then it wants my password, which I also have. 0:07:16.180000 --> 0:07:20.520000 All right, and then we're good. 0:07:20.520000 --> 0:07:22.240000 We're gonna get a networking. 0:07:22.240000 --> 0:07:24.700000 All right, I'm gonna give this a public IP address. 0:07:24.700000 --> 0:07:28.240000 I'm gonna specify any ports that I want accessible. 0:07:28.240000 --> 0:07:31.820000 If I want to give this a custom name, my own custom DNS label, I can do 0:07:31.820000 --> 0:07:34.820000 that. I'm not going to at the moment. 0:07:34.820000 --> 0:07:38.040000 All right, now this is a part that I actually think is really cool. 0:07:38.040000 --> 0:07:42.980000 I have the ability to add in environment variables. 0:07:42.980000 --> 0:07:47.640000 And just so you know, the container, the image that I'm deploying as a 0:07:47.640000 --> 0:07:51.780000 container is based on ASP net core MVC. 0:07:51.780000 --> 0:07:55.640000 And there's a couple of connection strings, which this is extremely bad 0:07:55.640000 --> 0:07:58.860000 security practice to show you these, but just let me assure you, by the 0:07:58.860000 --> 0:08:01.240000 time you view this video, these will no longer be valid. 0:08:01.240000 --> 0:08:03.080000 So I'm not doing too bad. 0:08:03.080000 --> 0:08:08.020000 But in any case, that ASP net core MVC application, the way it's currently 0:08:08.020000 --> 0:08:11.000000 written requires these connection strings. 0:08:11.000000 --> 0:08:13.180000 Well, how do I pass it down to that container? 0:08:13.180000 --> 0:08:16.820000 The turns out, I can do that by simply passing environment variables. 0:08:16.820000 --> 0:08:19.700000 So I'm gonna set up a couple of environment variables. 0:08:19.700000 --> 0:08:24.280000 Got a storage connection. 0:08:24.280000 --> 0:08:31.200000 And take that value. 0:08:31.200000 --> 0:08:33.980000 And I've got a database connection. 0:08:33.980000 --> 0:08:44.920000 Hopefully I'll remember to change these before this gets published. 0:08:44.920000 --> 0:08:48.460000 That way, we're not gonna have terabytes of data surpetitially stored 0:08:48.460000 --> 0:08:52.020000 there. Anyways, that's it, pretty simple. 0:08:52.020000 --> 0:08:58.480000 I set up the configuration of my container that I want, any networking, 0:08:58.480000 --> 0:09:03.640000 any ports, and then any environment variables. 0:09:03.640000 --> 0:09:06.520000 And then I simply create it. 0:09:06.520000 --> 0:09:12.040000 All right, it looks as though my container instance has deployed. 0:09:12.040000 --> 0:09:14.220000 So let's go check it out. 0:09:14.220000 --> 0:09:17.140000 I'm gonna go to the resource. 0:09:17.140000 --> 0:09:19.880000 And I can see I've got an IP address. 0:09:19.880000 --> 0:09:25.600000 I can actually view my container processors actually built in logging. 0:09:25.600000 --> 0:09:29.840000 All right, so if I wanna view the log of my container, there's the container 0:09:29.840000 --> 0:09:32.500000 as it's running, but not very exciting. 0:09:32.500000 --> 0:09:38.800000 You can actually even connect in and manage the container. 0:09:38.800000 --> 0:09:41.300000 And view properties of the container. 0:09:41.300000 --> 0:09:46.140000 So lots of information there, but I want the payoff, hopefully here. 0:09:46.140000 --> 0:09:54.440000 Go to my IP address, I'm gonna copy that public IP address. 0:09:54.440000 --> 0:09:56.000000 And there we go. 0:09:56.000000 --> 0:10:01.240000 Here I have my web app and that's successfully pinged and I can do a queue 0:10:01.240000 --> 0:10:03.300000 load and then a queue unload. 0:10:03.300000 --> 0:10:07.500000 What that means is that not only, and you'll I guess have to take my word 0:10:07.500000 --> 0:10:10.080000 for it because I could have just programmed that in. 0:10:10.080000 --> 0:10:14.400000 But what those do is make sure that I've got good connection between the 0:10:14.400000 --> 0:10:16.120000 web page itself and some back end services. 0:10:16.120000 --> 0:10:21.400000 And in fact, can connect to both a storage account and a database based 0:10:21.400000 --> 0:10:25.800000 on those connection strings that I inserted via environment variables. 0:10:25.800000 --> 0:10:27.680000 So this is one of those things. 0:10:27.680000 --> 0:10:31.820000 Honestly, I've been working with containers and I'm not a container expert, 0:10:31.820000 --> 0:10:35.220000 but I've been working with containers for a few years. 0:10:35.220000 --> 0:10:38.160000 And the more I use them and the more I see how easy it is to implement 0:10:38.160000 --> 0:10:46.060000 them within Azure, within the cloud in general, it really becomes for 0:10:46.060000 --> 0:10:48.880000 it. If I'm developing something back in, honestly, you're gonna have to 0:10:48.880000 --> 0:10:54.060000 convince me not to use containers if you don't want me to use them. 0:10:54.060000 --> 0:10:58.140000 So this is about the easiest way that you can spin up any kind of container, 0:10:58.140000 --> 0:11:01.440000 host it and not have to worry about anything other than container itself.