Check out a free preview of the full AWS for Front-End Engineers (ft. S3, Cloudfront & Route 53) course:
The "Introducing the AWS CLI" Lesson is part of the full, AWS for Front-End Engineers (ft. S3, Cloudfront & Route 53) course featured in this preview video. Here's what you'd learn in this lesson:

Steve takes a quick tour of the AWS CLI. Steve also sets up named profiles and other configuration for the AWS CLI.

Get Unlimited Access Now

Transcript from the "Introducing the AWS CLI" Lesson

[00:00:02]
>> Steve Kinney: So, we saw that you could upload a index.html by finding it on your file system and, I think you can also drag and drop it, which is even more rewarding. But that's not really great. It will be better if we could somehow in our build process be able to upload the assets, right?

[00:00:25] So we can do something like, okay, Webpack, go ahead and build my React application. And all this'll work just as well for an Angular application or an Ember application or what have you. A View application, your Vanilla JavaScript with Webpack project. Anything along those lines. This is completely agnostic, I just hollowed out a react application for the demo.

[00:00:49] So I'm gonna use ideas from react. But none of this matters, this is about taking any app that you have and deploying it. So what we want to do is be able to use it from the command line. If you have never set this up before you've installed the AWSCLI, you can type in AWS configure, right?

[00:01:07] And this will kind of get the basic doc files ready for you, and it'll ask you a few questions. And so it'll ask you for your AWS access key ID. And then that secret. So if you didn't download the CSV this'll be the first time in your life you have to go and regenerate that key cuz you'll never see it again.

[00:01:29] But ideally you have it saved in a CSV. A default region name. Let's no matter where you are in the world, let's agree to use us-east-1 right now. The reasoning for that is anything that is global is located in us-east-1 and Cloudfront is global, right? And when we want to add lambda edge functions to our Cloudfront distribution, those will all need to be in us-east-1 as well.

[00:01:56] And so I would implore you not to add a layer of complexity as you're first learning stuff by picking a different region 'cuz eventually, you'll setup your lambda function in US West 2 or whatever. And you'll go to add Cloudfront 2 and Cloudfront won't be in the UI and you'll think that I'm insane, which is true.

[00:02:20] But like that's not the issue, it's just that you can't put lambdas on Cloudfront in US-West-2. And there's not really like, they don't have a really great way of telling you that. It's just not there, and you will be sad, all right? And that's the example I can think of I can't, off the top of my head like there's probably other cases where you will also be sad.

[00:02:39] So let's stick with us-east-1, as our default region. And as you play around with this after the fact, you might wanna pick a different region. And again, we talked a little bit about possibly even deploying our applications to multiple regions. One that you never use, but you can then change the DNS to hit that other one instead at some point as well.

[00:02:59] All right, so we're gonna take really like three minutes, and we just go into the AWS configure as I put in my secret key and I'll join you back here in like a minute or two. All right, so we've got that set up. I set up on my machine as well.

[00:03:16] Kind of question that comes up pretty frequently is, we might talk a little bit about making multiple accounts for multiple users. And so how would we support that if these are environment variables? Turns out, you can have multiples profiles with the AWS CLI. And so, if you go ahead and you just made a directory called .aws as a hidden directory in your root folder, And then there are two files in there config and credentials.

[00:03:43] How you answered four questions? The credentials part are in the credentials file. What region and what output format you want your error logs was in the configs. So you can change that any time. The other interesting part you see that default out there, that will be if you don't specify a profile what it will use.

[00:04:01] But you can have multiple Amazon users in your command line tool, all right? And so the way you would use this is the dash dash profile flag. And so if you don't specify a dash dash profile flag, you're going to get a default. But if you dash dash profile space side project it's going to use a different set of keys.

[00:04:22] All right, and so like if you play multiple things you might wanna have that in part of your build process or something along those lines. We're just gonna use the default today but, that way you can like work on work stuff and then have side projects or like.

[00:04:36] It stops you from making one like global user that can control all of your different assets. You can actually like at least provision it separately.