REST API using AWS SAM + AMPLIFY - Part 2
Tags: tutorial, aws, awssam, serverless
Published: 2023-08-19 02:46:52

# Pre-requisite

Before you install and utilize the **AWS Serverless Application Model Command Line Interface (AWS SAM CLI)**, ensure you've met the necessary prerequisites.

For effective use of the AWS SAM CLI, you must have:

- An AWS account, along with AWS Identity and Access Management (IAM) credentials and an associated IAM access key pair.

- The AWS Command Line Interface (AWS CLI) installed, which is essential for setting up AWS credentials.

---

# Overview
For this tutorial we are going to do the following:

1. Sign up for an AWS account
2. Create an IAM user account
3. Create an access key ID and secret access key
4. Install the AWS CLI
5. Use the AWS CLI to configure AWS credentials
6. Install AWS SAM

---

### Step 1. Sign up for an AWS Account
[https://portal.aws.amazon.com/billing/signup]
(https://portal.aws.amazon.com/billing/signup). 
If you have not done so. Just follow the online instructions. 

### Step 2. Create an IAM user account: 
- Log in to your AWS Account.
- Type IAM on the search bar and click 
![Dashboard search bar, type IAM](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ogu92v2tog177e0sczar.png)

![IAM dashboard](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pzjwybxzhivs46wo1a6e.png)
- From the IAM Dashboard, on the left hand side of your screen go to Access Management > User
- On the top right of your screen click "Create User".

![Create a username](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qj3r5ml8wy0e4baoe49y.png)
- Fill in the username. For this example I will create "SamIAM".
- Click "Next"

![Select permissions](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7k9blz0isk973c7f7900.png)
- Under Permissions Options, select "Attach policies directly"
- Under Permissions policies, select "AdmistratorAccess"
- Scroll to the bottom and click "Next".


![Create the user](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nrqjlad7thsolww46rum.png)
- For the next page, Review and create, just click "Create User"


### Step 3. Create an access key ID and secret access key
- You will be prompted back to the main dashboard. Just select the user you just created, "SamIAM".

![Create access key and secret access key](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1cevcuz2ttpu9ichh6ko.png)
- Click on "Security Credentials" tab
- Scroll down and click "Create access key"


![Select CLI for use case](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qe5pw8zse3g51e3hpzw9.png)
- Under "Use case" select "Command Line Interface (CLI)
- Select the confirmation in the bottom, "I understand the above recommendation and want to proceed to create an access key."
- Click "Next".


![Create the access key](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qup90xnio2tbsq9nhfr5.png)
- Ignore this page, just click "Create access key".


![Download the credentials](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8393d496f6qa80rg1til.png)
- Copy the Access key and Secret access key to a notepad. You will need this when setting up your AWS CLI.
- For security, click "Download .csv file" and save that file in your personal drive. 


### Step 4. Install AWS CLI
- Click here and follow the instructions: [https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html)

### Step 5. Use the AWS CLI to configure AWS credentials

To configure credentials with the AWS CLI: 

- Run the `aws configure` command from the command line.

- Configure the following. Select each link to learn more:

[Access key ID](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html#cli-configure-quickstart-creds)

[Secret access key](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html#cli-configure-quickstart-creds)

[AWS Region](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html#cli-configure-quickstart-creds)

[Output format](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html#cli-configure-quickstart-creds)

The following example shows sample values.

```bash
$ aws configure
AWS Access Key ID [None]: AKIAIOSFODNN7EXAMPLE
AWS Secret Access Key [None]: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
Default region name [None]: us-east-1
Default output format [None]: json
```

### 6. Finally, install AWS SAM
Just follow the instructions in this link:
[https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/install-sam-cli.html](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/install-sam-cli.html)


---


## Next [Part 3: React App, Github Repo & AWS Connections](https://dev.to/ethanlloyd21/amplify-aws-sam-part-3-create-react-github-4mh3)