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