DEV Community

Cover image for REST API using AWS SAM + AMPLIFY - Part 2
Lloyd Marcelino
Lloyd Marcelino

Posted on • Updated on

REST API using AWS SAM + AMPLIFY - Part 2

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.
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

IAM dashboard

  • 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

  • Fill in the username. For this example I will create "SamIAM".
  • Click "Next"

Select permissions

  • Under Permissions Options, select "Attach policies directly"
  • Under Permissions policies, select "AdmistratorAccess"
  • Scroll to the bottom and click "Next".

Create the user

  • 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

  • Click on "Security Credentials" tab
  • Scroll down and click "Create access key"

Select CLI for use case

  • 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

  • Ignore this page, just click "Create access key".

Download the credentials

  • 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

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

Secret access key

AWS Region

Output format

The following example shows sample values.

$ 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
Enter fullscreen mode Exit fullscreen mode

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


Next Part 3: React App, Github Repo & AWS Connections

Top comments (0)