Setting Up Your AWS Credentials

How to Add Your Access Key, ID, and Region to Your Machine

April 18, 2020

Alright, let's dive right in. I'm assuming you already have an AWS account. If not, you'll need to take care of creating an account for yourself in order to continue with this post.

Start by running npm install aws-cli or yarn add aws-cli from the command line. This will install the AWS command line that's required in order to be able to deploy anything to AWS.

Our next step is to create a new access key from IAM. From the AWS website, click on the 'My Account' dropdown in the navbar and then click on 'Security Credentials'.

Security credentials.

Next, find the 'Access keys' dropdown and click it, then click 'Create New Access Key'.

Access keys

You should see the following modal. You can choose if you want to download the key file or show the access key. We're about to save your key and ID to your aws credentials file on your machine so simply showing the values is fine, but downloading this file doesn't hurt and ensures you always have access to these values. Once you close the tab you're in, or get logged out due to inactivity, you'll no longer be able view your access key. If you lose it, it's gone forever.

Creating an access key.

Head over to your terminal and run aws configure. You'll first be prompted to add your key ID so copy and paste that in. Next you'll need to paste in your secret access key. For the last 2 prompts, region name and output format, you can just go ahead and hit enter.

aws configure

Now, for those of you who don't know, your AWS key id and secret access key should be kept in a secure and safe placed and never shared online. If someone gets access to these, they can potentially gain access to whatever these values are attached to in AWS. The key id and access key I've used are solely demonstration purposes and will be deleted as soon as I've published this post. You may have noticed in an earlier screenshot I included that I covered and key ID that is being used for a personal project.

To confirm your region, output, key ID, and secret access key were set correctly, run the commands seen in the following screenshot and you should see a similar output:

AWS credentials on your machine.

Now you're all set. You can easily deploy to AWS using any number of their services. If you're new to AWS and looking for something get started with, I recommend trying to build your own Alexa skill and then deploying your lambda function.

Share this post: