00:00 Now's immutable deploys are powerful. To remind you what we're talking about, let's say I deploy a given instance of my application. I'm going to get a URL for it, and then I make some kind of a change. Let's say, we're going to go back to the retro Hello World! Instead of Hello Universe! And then deploy it.
00:20 I'm going to get a new URL. There's my old one. There's my new one. Let's go visit the old one first. That's going to say Hello Universe! And then let's grab this one. That's going to say Hello World! That's the problem. Which URL should my customers be going to? I'm confused now. What should I do?
00:49 The answer is neither. Obviously, you don't want to share a URL that looks like this. Instead, we're going to do something. We're going to create a Now alias which is built-in support for this and this is an important part of the Now workflow.
01:03 To use it, we're going to type now alias, and then we're going to paste the URL that we want to be pointing to. In this case, it's our most recent deploy, and then we're going to give it a name. In this case, let's say egghead-course. Now, look what it said. It says Alias created https://egghead-course.now.sh.
01:27 Now, if I go here to egghead-course.now.sh, I see that I'm getting the same thing that I was getting here. Great. I can alias to a URL. How does that actually help me solve my problem? The trick is that I never give this URL to anyone ever. This is internal. This is a reference.
01:55 Think of this as almost like a git commit hash. That's effectively what this is. This is a specific snapshot of my logic and I don't want any of my customers to be looking at snapshots. What I want them to be looking at is a nice user-friendly URL.
02:09 Let's say I go through then and I make some more edits. I say Hello World! I add a paragraph here. This is a new paragraph of content! I'm going to deploy this. I'm going to get yet another URL. That's running. Let's paste that new URL in here. This is a new paragraph of content!
02:42 There's our old one. There's our new one. Our alias is still pointing at the old one, so this is crucial. Once I see that this deployment works the way I expect it to work, all I have to do is go back and type now alias with the new URL, the name egghead-course.
03:04 What that's going to do is change the pointer. Now, when I refresh egghead-course, it's now pointing at this new endpoint instead of at the old one. This is how this works with immutable deploys. You have any number of these instances that are spun-up, deployed, and running around in the wild, but the alias is the thing that you care about.
03:28 On a free account, this is totally free. You get your 20 deploys a month for free right now as of this recording. You're allowed to alias to any phrase and the URL that you get is going to be that phrase.now.sh.