Python for the .NET Developer Transcripts
Chapter: Deploying Python web apps
Lecture: The cost of cloud hosting compared

Login or purchase this course to watch this video and the rest of the course contents.
0:00 Let's talk a little bit about the benefits of deploying directly on Linux and the choices that we're making here. I told you about some, the features
0:08 how you're going to learn basically more if you do all the steps and then you can roll it back to use some platform as a service. The way I see it
0:15 there's, like, two really good getting started places. We have DigitalOcean and we have Linode. And these places are super affordable, super flexible.
0:24 They have tons of data centers. They're really, really good options. There are certain circumstances where deploying on Azure
0:31 or deploying on EC2 makes more sense. If your company's all in on those, fine. Let your company foot the bill. But if you care about the price
0:37 and you care about the flexibility you probably want to come over here. So we'll look at those options. Linode's a great option.
0:43 We're not going to deploy to it just because I have more experience with DigitalOcean. Another good option in addition to Azure and AWS is Heroku
0:51 and it's very common in the Python world. You can create one of these Heroku dynos which is basically a little virtual machine app hosted app thing.
1:01 It's not a dedicated virtual machine that you get but you can, like, run and scale it and so on. Pretty cool.
1:07 It's super easy to get started with Heroku. Like I said, if you want to get done let's see, we go over here. So once you're in if you have a git repo
1:16 you can just type, once you have the API command line interface installed just type Heroku create
1:21 and that will set up another endpoint for your git repo. And then to deploy you simply do a git push Heroku master
1:28 and that does it. And it does all this cool stuff. You can see it actually gets all the bits gets it running, and then boom
1:35 there it is off and deployed. You can even scale it. That's super. So the challenge here with this is it's kind of expensive.
1:43 So you pay for this tradeoff, right? If you want to run those, that sort of code here's a passable minimum web instance, right? This one is $25.
1:54 This one is probably what you really need and the M&L change prices there, as well as those, right? So these can get pretty pricey pretty quickly.
2:03 And then you don't directly get to put databases there. You've got to, you know, like use the Postgres as a service which also adds on to features.
2:10 So you don't have a ton of control and you get sort of bought in deeply to kind of, like a lot of commitment over here. A lot of people love Heroku.
2:17 I told you why I'm not particularly using it here, right? You totally do what you want. Let's look at DigitalOcean. Okay, so DigitalOcean is great.
2:25 They let you create virtual machines. They have awesome networking. Lots of data centers throughout the world. They have load balancers.
2:32 They also have Kubernetes and hosted Postgres and stuff if you want to use it but you don't have to. But, so let's check this out.
2:37 Let's go to pricing real quick. So let's go to compute real quick here. So we have some nice options. Here's some shared CPU
2:44 but dedicated virtual machines that you can run into or you could get dedicated CPUs if you really want to go bigger. So here, check this out.
2:52 We've got, like, two gigs with one CPU and two terabytes of traffic and a 50 gig SSD for $10 a month flat. That's pretty interesting. That's good.
3:04 Let's go over here, like, to the Azure calculator. I'm going to choose Azure 'cause I'm guessing
3:08 that a lot of folks who are .NET developers are familiar or considering or whatever something like that. So let's say we want a virtual machine
3:14 we're going to add that and we cannot forget about bandwidth because that's a super important consideration.
3:21 Let's go over here and say we're going to run Linux. I don't really think it changes the price here.
3:26 Yeah, we'll go, I guess we could go with a low priority. We'll go with that character right there. I don't really know all the options that well
3:36 but let's just say that this one it's pretty close to this option that I pulled over here. It's not two gigs, but it's pretty close.
3:43 1.75. Let's say that's good enough. And this is the time for one month. So it's $8 and 76 cents versus $10. Oh, well, why don't we pick this?
3:55 Maybe this is a great option. Well, let's go down to the bandwidth side of things. Did you notice over here
4:02 that this comes with two terabytes of free bandwidth? Do you know how much two terabytes of bandwidth costs over here? Well, let's put two in there.
4:11 Oh, 177 additional dollars. So we go down to our total. Our total is now $186. When it looked like, oh
4:22 this one is actually $150 more expensive than the other one. No, it is not. Not in practice. I find, like, EC2 has the same type of pricing.
4:32 It seems great until, like you start to put all the pieces together and you're like, whoa this is super pricey. And you might say, well, Michael
4:38 who's going to need two terabytes? That's ridiculous. Well, let me just show you over here. I pulled up the price on my system.
4:47 So right now I have eight servers doing a ton of stuff. So running the Talk Python to Me podcast running the Python Bytes podcast
4:55 running a whole bunch of little services behind the scenes and running the training websites and the only thing not accounted for in DigitalOcean
5:03 is the video streaming. That's completely separate, okay? Completely separate. So the video traffic doesn't count here
5:10 but MP3s, HTML, XML all that kind of stuff shows up here. And because I'm paying for those eight servers I have some high end ones.
5:19 We're paying $83 so far this month and it's mostly, it's close to the end of the month, okay? So, say two thirds of the way through the month.
5:27 Now check this out. If we scroll down a little bit oh yeah, here we are. So, up to the 22nd. We can break this out into the charges.
5:34 So droplets are 75 and I have, like, some backups and other stuff going on. So it's 75 bucks. But look at this. Look at that number. That's crazy.
5:44 Remember, this is not videos from the courses. This is not videos. Now, last month we used 14 terabytes of traffic without videos.
5:53 And how much did we pay? A little bit less than $100. Let's go back here and adjust this for, like, my situation
6:00 'cause this is the two you got for free. Over here, we said actually we're not going with this minimum one.
6:07 I've got, like, this is probably running about that's probably what I'm running over there. And I have eight of these.
6:15 So 140, which doesn't look that bad until you add in the bandwidth of 14 to 15. And now what's our subtotal? Subtotal is $1,455.
6:27 Last month at DigitalOcean, I paid under 100. That is 14 times more to do the same over here. And if I went to EC2, it's the same.
6:38 You know, slightly different but the pricing is almost the same. That's why I recommend you try something like DigitalOcean
6:45 or Linode or something like that if you're going to be doing a decent amount of traffic or they're just, they're really nice, as you'll see.
6:52 So I wanted to share some actual concrete experience. I know other people may be having wonderful experiences with Azure
6:58 and maybe you've had a bad experience with DigitalOcean or Linode or something like that and that's fine. You know, take that into account.
7:04 But my experience is basically what I laid out here for you. For that reason, we're going to go with DigitalOcean or something like Linode.


Talk Python's Mastodon Michael Kennedy's Mastodon