1 00:00:00,170 --> 00:00:01,600 Welcome to the Dev Team Show. 2 00:00:01,600 --> 00:00:02,810 My name is James. 3 00:00:02,810 --> 00:00:06,320 In this episode, we're gonna talk about cloud assumptions. 4 00:00:06,320 --> 00:00:08,410 Joining me is Scott Hanselman. 5 00:00:08,410 --> 00:00:09,409 Welcome to the show, Scott. 6 00:00:09,409 --> 00:00:10,245 >> How is it going? 7 00:00:10,245 --> 00:00:14,140 [MUSIC] 8 00:00:14,140 --> 00:00:17,288 I'm very familiar with deploying a website, 9 00:00:17,288 --> 00:00:22,070 hosting a website on a local server, pretty straightforward stuff. 10 00:00:22,070 --> 00:00:25,200 Even like I would describe as commodity hosting. 11 00:00:25,200 --> 00:00:29,750 Where I'd go buy some cheap hosting service, maybe that's $10 a month, right? 12 00:00:29,750 --> 00:00:31,630 Deploy up there, very simple. 13 00:00:31,630 --> 00:00:33,750 I can add a site, configure that site, 14 00:00:33,750 --> 00:00:36,560 deploy my site up there, pretty simple stuff. 15 00:00:36,560 --> 00:00:40,050 Very similar to what I did locally but cloud. 16 00:00:40,050 --> 00:00:44,580 I created an Azure account, and now, I just kinda repeat and do the same thing. 17 00:00:44,580 --> 00:00:46,070 Am I doing something wrong? 18 00:00:46,070 --> 00:00:50,947 Am I missing kind of the point of why I would even be interested in 19 00:00:50,947 --> 00:00:55,099 doing stuff up on Azure and doing cloud development? 20 00:00:55,099 --> 00:00:58,386 >> Okay, so the word cloud is one of those words like containers, 21 00:00:58,386 --> 00:01:01,930 where it's like it's fun to say, it feels good in your mouth. 22 00:01:01,930 --> 00:01:04,380 Cloud, cloud, but, what does that mean? 23 00:01:04,380 --> 00:01:07,660 Is cloud's what like younger people call hosting? 24 00:01:07,660 --> 00:01:09,110 It's more than that. 25 00:01:09,110 --> 00:01:12,300 I like to think about it in terms of what is virtual, and what is physical? 26 00:01:12,300 --> 00:01:14,480 And what is elastic, and what is not? 27 00:01:14,480 --> 00:01:18,680 So if I made a website on a machine or a Virtual Machine, 28 00:01:18,680 --> 00:01:23,730 and I put it on a host, lower case h, or upper case H, it doesn't matter. 29 00:01:23,730 --> 00:01:28,050 Some local inexpensive host, I could visit my computer. 30 00:01:28,050 --> 00:01:31,240 I could go down, I could drive down to that host, and I could find that machine, 31 00:01:31,240 --> 00:01:35,540 and I could say, show me my C drive, or show me my mount point. 32 00:01:35,540 --> 00:01:37,560 Where's my site? 33 00:01:37,560 --> 00:01:40,500 Well, it's on this spinning rushed 34 00:01:40,500 --> 00:01:44,660 disc on this rack in this room with a wire that goes to the wall. 35 00:01:44,660 --> 00:01:46,090 That's your computer. 36 00:01:46,090 --> 00:01:47,610 That is hosting. 37 00:01:47,610 --> 00:01:48,810 Sometimes in the old days, 38 00:01:48,810 --> 00:01:51,750 you used to actually physically take your computer down there. 39 00:01:51,750 --> 00:01:53,795 And you would literally be buying a slot in the rack. 40 00:01:53,795 --> 00:01:54,830 >> Co-locating, yeah. 41 00:01:54,830 --> 00:01:56,320 >> You would co-locate, right? 42 00:01:56,320 --> 00:01:59,440 Then it got to the point where you just FTP your code, 43 00:01:59,440 --> 00:02:01,200 you'd send your code up there. 44 00:02:01,200 --> 00:02:06,243 But when you move into the cloud, if you treat the cloud as a host, 45 00:02:06,243 --> 00:02:09,471 as a simple host, that is a rather naive. 46 00:02:09,471 --> 00:02:12,565 And that's not meant to be a diminutive, it's just simply to be a descriptive word. 47 00:02:12,565 --> 00:02:14,615 It's a naive way to think about hosting. 48 00:02:14,615 --> 00:02:17,520 You can take a Virtual Machine, and do what's called lift and 49 00:02:17,520 --> 00:02:21,950 shift, and move that into the cloud, and you go look, we're into the cloud. 50 00:02:21,950 --> 00:02:25,788 When I move something over in the cloud though, and I treat the cloud as a host, 51 00:02:25,788 --> 00:02:28,308 I'm missing out on the fact that it can be elastic. 52 00:02:28,308 --> 00:02:30,576 It can scale in different directions, and 53 00:02:30,576 --> 00:02:34,250 I'm also fooling myself in thinking I can visit it, okay? 54 00:02:34,250 --> 00:02:38,130 We've gone into an entirely virtual world right now, okay? 55 00:02:38,130 --> 00:02:40,830 So let's think about classic three tier architecture. 56 00:02:40,830 --> 00:02:45,350 This was when a website, and a shopping cart, and a product catalog would 57 00:02:45,350 --> 00:02:48,440 sit on top of some business objects that would then sit on top of a database. 58 00:02:48,440 --> 00:02:49,040 >> Right. >> Again, 59 00:02:49,040 --> 00:02:51,530 you could visit them all and you could go and put them somewhere. 60 00:02:51,530 --> 00:02:54,900 And if someone were gonna upload information to that particular 61 00:02:54,900 --> 00:02:58,380 application, maybe product images, you take those images and 62 00:02:58,380 --> 00:03:01,100 then you put them on the disk, right? 63 00:03:01,100 --> 00:03:04,870 And then what happens if there's now two web servers in that, 64 00:03:04,870 --> 00:03:06,580 there's now a web farm? 65 00:03:06,580 --> 00:03:08,910 Well, if I go and hit it, I'm gonna hit www1, and 66 00:03:08,910 --> 00:03:12,300 then ww2, and I'll bounce back and forth. 67 00:03:12,300 --> 00:03:16,947 Each time I upload my images, they might show up on a different disk. 68 00:03:16,947 --> 00:03:20,498 So now, I have some scale problems, and I have an issue with what's called node 69 00:03:20,498 --> 00:03:24,102 affinity, where I have an affinity with one node and that's where all of my thing 70 00:03:24,102 --> 00:03:27,960 get uploaded to, and I have affinity with this node it gets uploaded to there. 71 00:03:27,960 --> 00:03:32,620 So then I might make a shared disc, right, and then have a mapped drive. 72 00:03:32,620 --> 00:03:35,960 But now, I've got three things, I've got two Virtual Machines and a disc. 73 00:03:35,960 --> 00:03:38,010 Then I think, we'll maybe I'll put the files in the database. 74 00:03:38,010 --> 00:03:39,650 Well, is that really where they belong. 75 00:03:39,650 --> 00:03:43,570 Suddenly, you start getting into interesting problems of scale. 76 00:03:43,570 --> 00:03:47,295 You can ask yourself, do I scale out more computers? 77 00:03:47,295 --> 00:03:50,860 Or do I scale up, bigger, fancier computers? 78 00:03:50,860 --> 00:03:55,620 If I simply move over into the cloud, and then try to solve those problems in those 79 00:03:55,620 --> 00:03:59,190 ways, suddenly, I'm not really doing product catalog and 80 00:03:59,190 --> 00:04:03,478 a shopping application anymore, now I'm doing kind of aministrivia. 81 00:04:03,478 --> 00:04:05,850 Just administrative moving around of Virtual Machines. 82 00:04:05,850 --> 00:04:08,780 It's the same problem I had before, except instead of moving 83 00:04:08,780 --> 00:04:11,608 around physical machines, I'm moving around Virtual Machines. 84 00:04:11,608 --> 00:04:14,680 What you wanna do is when you move over to the cloud, do your lift and shift. 85 00:04:14,680 --> 00:04:15,800 It's okay to do that. 86 00:04:15,800 --> 00:04:20,290 But then also think to yourself, how can I make my application cloud native? 87 00:04:21,410 --> 00:04:25,817 So a cloud native application doesn't write to the disk, right? 88 00:04:25,817 --> 00:04:29,786 It writes to some cloud based storage, whether it be Amazon S3, or 89 00:04:29,786 --> 00:04:34,750 Azure storage, or some Mongo database out there in the world, or SQL Server. 90 00:04:34,750 --> 00:04:40,465 Some mutable storage that is available to me via an API. 91 00:04:40,465 --> 00:04:45,525 Someone goes and uploads an image, I never write to my local disk, I send it off into 92 00:04:45,525 --> 00:04:50,155 Azure Document DB, or some where, or S3, or whatever, it's nondenominational. 93 00:04:50,155 --> 00:04:52,665 These concepts are not specific to Microsoft Azure, or 94 00:04:52,665 --> 00:04:55,055 Google Cloud, or Amazon. 95 00:04:55,055 --> 00:04:57,770 These are, how to architect for the cloud. 96 00:04:57,770 --> 00:05:01,407 Then I might wanna ask myself, well, how does this web server talk to these 97 00:05:01,407 --> 00:05:03,846 business objects that then talk to the database? 98 00:05:03,846 --> 00:05:07,924 >> Right, if I'm doing development locally, how does that change that, right? 99 00:05:07,924 --> 00:05:09,965 I mean you're talking about not touching the disk anymore. 100 00:05:09,965 --> 00:05:11,406 Do I just abstract that away, and 101 00:05:11,406 --> 00:05:14,143 I am actually touching the disk when I'm developing locally? 102 00:05:14,143 --> 00:05:16,960 Or is there some way of emulating that service locally? 103 00:05:16,960 --> 00:05:18,420 >> It all depends on what you decide to chose. 104 00:05:18,420 --> 00:05:21,478 So, for example, if it's Mongo, and that's gonna be your object store. 105 00:05:21,478 --> 00:05:23,930 Then you're gonna run an instance of Mongo locally. 106 00:05:23,930 --> 00:05:27,750 And then you can have one in the cloud, or use a third party like MLabs. 107 00:05:27,750 --> 00:05:29,890 If you're doing something like Azure DocumentDB, 108 00:05:29,890 --> 00:05:33,600 which is kind of like a JSON based document store. 109 00:05:33,600 --> 00:05:36,440 You could have a local DocumentDB emulator. 110 00:05:36,440 --> 00:05:39,960 If you're gonna talk to storage, Azure Storage or S3, 111 00:05:39,960 --> 00:05:41,960 there's an Azure Storage Emulator. 112 00:05:41,960 --> 00:05:45,015 So you can simulate your own internal Cloud. 113 00:05:45,015 --> 00:05:47,290 But then you have to start thinking about decoupling. 114 00:05:47,290 --> 00:05:52,144 Is the product catalog that receives these new product images going to just talk 115 00:05:52,144 --> 00:05:53,312 directly to that? 116 00:05:53,312 --> 00:05:54,858 Or is there gonna be an intermediary? 117 00:05:54,858 --> 00:05:55,620 >> Right. 118 00:05:55,620 --> 00:05:58,810 >> Then you wanna ask yourself, when parts of my site go down, 119 00:05:58,810 --> 00:06:01,560 does it make the entire site go down, right? 120 00:06:01,560 --> 00:06:06,100 Netflix is really great where if parts of Netflix goes down like adding a DVD to 121 00:06:06,100 --> 00:06:11,120 your cart or searching for a movie, that doesn't make the movie stop playing, 122 00:06:11,120 --> 00:06:13,350 like Netflix doesn't entirely go down. 123 00:06:13,350 --> 00:06:15,960 One of the microservices within Netflix goes down. 124 00:06:15,960 --> 00:06:20,735 So if I have a single virtual machine and it falls over my product catalog is gone, 125 00:06:20,735 --> 00:06:22,630 my shopping cart is gone. 126 00:06:22,630 --> 00:06:27,170 But if I had a shopping cart service, and an identity service, and 127 00:06:27,170 --> 00:06:30,020 a checkout service, and taking money from the customer service, and 128 00:06:30,020 --> 00:06:31,370 a product catalog service. 129 00:06:31,370 --> 00:06:34,200 Can I architect my application where they are loosely coupled? 130 00:06:34,200 --> 00:06:37,590 So that any one of those could go down, and the site wouldn't fall over. 131 00:06:37,590 --> 00:06:40,260 >> Or you could even scale those independently of each other, right? 132 00:06:40,260 --> 00:06:41,330 >> Exactly, exactly. 133 00:06:41,330 --> 00:06:45,440 And then that allows you to then containerized those in the future. 134 00:06:45,440 --> 00:06:47,630 So there's levels of increasing maturity. 135 00:06:47,630 --> 00:06:50,860 Lift and shift is fine, but you don't wanna stick with that. 136 00:06:50,860 --> 00:06:55,950 Start breaking things up into different Virtual Machines or Platform as a Service. 137 00:06:55,950 --> 00:06:59,978 Platform as a Service is like where an Azure app service, or 138 00:06:59,978 --> 00:07:04,986 an Azure website, sits on top of a Virtual Machine that I chose to ignore. 139 00:07:04,986 --> 00:07:07,855 I know it exists, but I pretend that it doesn't exist. 140 00:07:07,855 --> 00:07:11,990 Like at Heroku, or Google Cloud, they all have Virtual Machines, but 141 00:07:11,990 --> 00:07:14,660 they hide them from us effectively. 142 00:07:14,660 --> 00:07:18,501 So if you ask yourself as you decide to move your application into the cloud, 143 00:07:18,501 --> 00:07:21,333 do I want to know, care, and love my Virtual Machines? 144 00:07:21,333 --> 00:07:22,580 >> [LAUGH] >> Or 145 00:07:22,580 --> 00:07:26,990 do I really just wanna borrow them, and not really think about them? 146 00:07:26,990 --> 00:07:29,070 It's almost like pets for hire, like you can get a dog, but 147 00:07:29,070 --> 00:07:30,970 you gotta keep it watered, and fed, and all that. 148 00:07:30,970 --> 00:07:34,032 I don't have a dog, so I don't know how you have to water the dog. 149 00:07:34,032 --> 00:07:34,616 But you know what I mean? Or 150 00:07:34,616 --> 00:07:38,460 I can just borrow my brother's dog, and then I have a dog for hire, right? 151 00:07:38,460 --> 00:07:43,570 So Virtual Machines are not necessarily a business I wanna be in. 152 00:07:43,570 --> 00:07:48,579 The cloud has the ability to programmatically change to elastically 153 00:07:48,579 --> 00:07:54,920 grow both horizontally, or scale out more Virtual Machines or up, make them bigger. 154 00:07:54,920 --> 00:07:58,400 None of that is the same as a host where you can visit your hard drive. 155 00:07:58,400 --> 00:07:59,220 >> Yeah. 156 00:07:59,220 --> 00:08:03,780 So, if we start with the lifting and shift, Ship or shift? 157 00:08:03,780 --> 00:08:04,710 >> Shift. >> Shift. 158 00:08:04,710 --> 00:08:07,040 >> Lift a virtual machine and shift it to the cloud. 159 00:08:07,040 --> 00:08:07,540 >> Right. 160 00:08:07,540 --> 00:08:11,391 So, if you start with that, is there like a common path forward? 161 00:08:11,391 --> 00:08:15,344 You pick some part of your application, say, we're gonna turn this into a service? 162 00:08:15,344 --> 00:08:18,751 >> So if it's a web application, you wanna ask yourself, 163 00:08:18,751 --> 00:08:22,881 can I pick it up off the Virtual Machine, and put the web component, 164 00:08:22,881 --> 00:08:27,840 the page serving component, whether it's a node, or ASP.NET, or whatever. 165 00:08:27,840 --> 00:08:32,610 Can I move that into a PaaS, or Platform as a Service, environment? 166 00:08:32,610 --> 00:08:36,287 If I was picking up a blog that runs on a Virtual Machine, could I run that 167 00:08:36,287 --> 00:08:40,659 in Azure App Service, or in Google Cloud, or in Amazon Lambda, or somewhere else? 168 00:08:40,659 --> 00:08:43,110 >> You might leave the database behind. 169 00:08:43,110 --> 00:08:45,570 >> And then later on, could I move the database somewhere else? 170 00:08:45,570 --> 00:08:48,770 Then I could say, well, using the product catalog example, 171 00:08:48,770 --> 00:08:52,900 could I somehow tease the product catalog and shopping cart separate? 172 00:08:52,900 --> 00:08:55,238 >> Right. >> And have shopping cart dot my website 173 00:08:55,238 --> 00:08:55,777 dot com? 174 00:08:55,777 --> 00:08:59,482 >> So instead of thinking of these horizontal layers in your application, 175 00:08:59,482 --> 00:09:02,040 you started thinking in vertical slices. 176 00:09:02,040 --> 00:09:03,750 And think, well, maybe products. 177 00:09:03,750 --> 00:09:06,141 >> In functional slices, yeah, exactly. 178 00:09:06,141 --> 00:09:09,284 >> Cool [LAUGH]. 179 00:09:09,284 --> 00:09:10,903 >> That's a way that I think about the cloud. 180 00:09:10,903 --> 00:09:14,167 And I think that if you go out and explore those concepts, you'll be able to apply 181 00:09:14,167 --> 00:09:16,810 them to your own applications as you explore your learning here. 182 00:09:16,810 --> 00:09:17,362 >> All right, well, great. 183 00:09:17,362 --> 00:09:18,340 Thanks for sharing that, Scott. 184 00:09:18,340 --> 00:09:19,410 >> Thank you. 185 00:09:19,410 --> 00:09:21,310 >> Be sure to check the notes that accompany this video for 186 00:09:21,310 --> 00:09:23,090 links to additional resources. 187 00:09:23,090 --> 00:09:25,820 Also, rate this video, let us know how we're doing. 188 00:09:25,820 --> 00:09:28,850 Or if you have a topic that you'd like to see us talk about in the future, 189 00:09:28,850 --> 00:09:30,380 tell us about that too. 190 00:09:30,380 --> 00:09:31,165 See you next time. 191 00:09:31,165 --> 00:09:34,119 [MUSIC]