In order to deploy your static site to S3 from the command line you need to add your generated user credentials.
Do this by running aws configure
and pasting in the credentials that were generated after creating the user with IAM.
Instructor: [0:00] I've got a simple React application that I created just by running npx create-react-app and then the name of my demo, which is just egghead-s3-demo. I'd like to deploy this site to our S3 bucket. In order to deploy this site, I need a build of the site to be able to put on the S3 bucket.
[0:21] To do that, I'm going to run npm run build and let that run for a second. You can see, over on the left here, we've got this Build folder, and inside of that Build folder are our HTML and our images to be able to run this site.
[0:35] We could just drag and drop the contents of this Build folder into our S3 bucket. Instead, I'd like to be able to deploy our site using the AWS CLI tool. The instructions for how to install the AWS CLI are going to vary based on your computer.
[0:52] I'm not going to walk you through it. You'll know if you have it set up correctly if you can just type AWS into the command line and get a response that shows the system recognizes it as a command. I didn't have any arguments in here, and so it threw an error.
[1:06] In order to configure the CLI with our user that we created in the last video, we're going to need the credentials for it. I can clear this out and run aws configure, and it's first going to ask for our access key. Let's head back over to the browser real quick, copy this access key, and head back over to our code and paste in our access key.
[1:29] Now, it's asking for that secret access key. I'll hop back over to the browser. Ordinarily, you wouldn't want to show anybody your secret access key. I'm going to delete this user right after I create this video, though, so I'm not too concerned about it. I'm going to click Show. I'm going to copy that, head back over to our terminal, and paste it in and hit Enter.
[1:50] We don't need to worry about all of these options, like the Default Region Name or the Output Format. I'll clear that. Now, we've got our AWS CLI configured. In the next video, we'll go ahead and add a Deploy Script that will send up our React app to our S3 bucket.