Check out a free preview of the full The Hard Parts of Servers & Node.js course
The "Cloud Node Development" Lesson is part of the full, The Hard Parts of Servers & Node.js course featured in this preview video. Here's what you'd learn in this lesson:
Will explains how cloud development allows developers to run Node on external computers. Will also explains the role of devops professionals.
Transcript from the "Cloud Node Development" Lesson
[00:00:00]
>> Will Sentance: So far so good. But problem, does this mean, if I'm building server code, I need to be able to have Sarah Rose sent her message, have Michael send his message, have Rich send his message whenever he opens twitter.com, anytime, night or day. That means I need to have my computer plugged in to the Internet and always on forever.
[00:00:26]
And in the old days, that's what we did. Their computers plugged in to the wall n the whole time in our houses, in our office buildings. But man, It seems a lot a bit demanding on us. So what do we do instead? We have, it's a rhetorical question.
[00:00:42]
We have somebody else's computer be always on. We have somebody else's way that somebody else is a company that has a lot of computers that are always on, that we can rent out to use some of the space on their computers. And the three big companies that offer us the right to do that.
[00:01:00]
Michael, do you know who they are?
>> Michael: AWS.
>> Will Sentance: Amazon.
>> Michael: Google.
>> Will Sentance: Google, and Microsoft is the other big one. I mean, there's others out there but those are the three. They've got literally with Amazon's case one and a half million computer's that are always on and connected to the Internet.
[00:01:16]
They've got plenty of space for us to use one of them and that's exactly what we end up doing. Okay, do we need an always-on computer in our house for our server? No, we're gonna write it on our computer. Here's Will's computer, Will's Mac. I write code on VS Code on my Mac.
[00:01:36]
I save it to a file, over at my terminal. But I'm not using my terminal to control my computer. I'm gonna use it to control AWS's. AWS's computer, a computer on the Internet owned by AWS. And I'm going to do something called SSH, which is a way of securely patching in and interfacing with this computer through SSH.
[00:02:08]
So I'm actually gonna be in my terminal controlling this computer over here. And to do so, in order to turn on node, let's just use node for now, turn on node not on my computer but on Amazon's computer. And load up my server JS code to run, not on my computer, but on one of Amazon's always on computers.
[00:02:33]
And I can interact with that computer using SSH. And there's other ways of interfacing with this computer's set us up. Even GUI, even kind of clickable ways of doing so. Michael, go ahead.
>> Michael: I'm assuming that computer only has one port 80. So then if Amazon has more.
[00:02:49]
>> Will Sentance: Yeah, so it's really really sophisticated how this is handled. The one bit I am gonna tell you is this. Let's say Michael opens his computer, the untouchable area. This is where Michael's gonna open his computer. All right, where can Michael open his computer? Michael will open his computer here.
[00:03:12]
Michael's computer, sorry, Michael's little computer not a Michael's computer. There he is, Michael. He goes to Twitter.com
>> Will Sentance: Okay, that used to. When he went to Twitter.com, send a message to my computer or to Twitter's computer. But the problem is, now I put Twitter.com's Node app and all the ability to receive inbound messages at port 80 and send stuff back, I put it on Amazon's computer.
[00:03:41]
What do I do? Don't worry, something called DNS, domain name server. It's a ledger, ledger just means a comparison of two things side by side. Of all URLs, sorry of domain names. And an associated string of numbers that represents any computer. Every single computer has a unique string of numbers.
[00:04:05]
And let's say, previously Will's Mac it was 27.1.3.4 something like that. Twitter.com would've linked to that. Now I set it to link to AWS's computer, which is I don't know, 32.2.5.7, that's not obviously literally it, but 32.2.5.7. And so now Michael when you go to Twitter.com, you get this domain and is that that you then go and enter [LAUGH] Really, it almost got there, it really missed the entry point.
[00:04:41]
You then go and enter with your message saying, hey Amazon, I need Twitter.com, your tweets HTML, CSS jobs of now. Specifically how it handles when actually in Amazon it's not just one computer, you're dealing with a million possible computers. Specifically how you match up exactly how it enters, we're gonna hold on.
[00:05:04]
But we make all of the configurations, this is what is called DevOps. DevOps is the extremely interesting and challenging situation of ensuring that you've managed to get your code running on Amazon's computer with the node app running. And that when Michael go to twitter.com that this entry point is configured correctly, that this this IP address as it's known as.
[00:05:28]
That the URL is matched to is gonna enter at the exact right computer. Really interesting, sophisticated area that actually, someone tweeted to me about saying, could you do a hard parse on this piece? Because it is a major part now of what modern development is. No longer are you plugging a computer into the wall of your office, turning it on, turning on Node, and saying, we're good to go.
[00:05:52]
Now you've gotta get all this code onto Amazon's massive AWS infrastructure, and it's remarkably interesting. Do you have a follow-up, Michael?
>> Michael: Yeah, so each computer has multiple Node process, so once they enter that port is Amazon and figuring out which of these processes that-
>> Will Sentance: Processes, but certainly these computers, how they're working, they can handle on the same computer multiple apps running at the same time, multiple web apps running at the same time.
[00:06:18]
Or they can be distributed across multiple computers at the same time. This side of things once on AWS computer, we're not covering today but it's really really interesting. But our job here today is just we've got to get our code not to run on our computer but one of Amazon's.
[00:06:34]
For now just one of Amazon's computers, okay?
Learn Straight from the Experts Who Shape the Modern Web
- In-depth Courses
- Industry Leading Experts
- Learning Paths
- Live Interactive Workshops