Getting Started with AWS

Build a Full-Stack React Application

Create a simple web application using AWS Amplify

Module 2: Initialize a Local Amplify App

In this module, you will install and configure the Amplify CLI

Overview

Now that we have initialized a new Amplify project in our account, we want to bring it down into our local environment so we can continue development and add new features.

In this module, you will install the Amplify CLI and initialize the Amplify project using the CLI.

What you will accomplish

In this module, you will:
  • Install and configure the Amplify CLI
  • Initialize the Amplify app

Key concepts

Amplify CLI – The Amplify CLI allows you to create, manage, and remove AWS services directly from your terminal.

 Time to complete

5 minutes

 Services used

Implementation

  • The Amplify command line interface (CLI) is a unified toolchain to create AWS Cloud services for your app, following a simple, guided workflow. Let’s go ahead and install the Amplify CLI using the command prompt (Windows) or the terminal (macOS). Note: This command can be run in any directory in your command prompt/terminal because the “-g” indicates the binary will be installed globally on your system.

    npm install -g @aws-amplify/cli
  • AWS Identity and Access Management (IAM) enables you to manage users and user permissions in AWS. The CLI uses IAM to create and manage services programmatically on your behalf through the CLI.

    To configure the CLI, run the configure command. To see a video walkthrough of the CLI configuration process, see Installing & Configuring the AWS Amplify CLI below.

    Installing & Configuring the AWS Amplify CLI
    amplify configure
  • Next, we will deploy a backend and initialize the backend environment locally.

    a. In the Amplify console, select Backend environments and choose Get started. Wait for the backend to be deployed.

    b. On the Backend environments tab, choose Launch Studio.

    c. Return to the Backend environments tab and expand the Local setup instructions section. Copy the command to your clipboard and open the terminal on your computer.

    d. Paste the command into your terminal and follow the setup instructions.

    ? Choose your default editor: Visual Studio Code
    ? Choose the type of app that you're building javascript
    ? What javascript framework are you using react
    ? Source Directory Path:  src 
    ? Distribution Directory Path: build
    ? Build Command:  npm run-script build
    ? Start Command: npm run-script start
    ? Do you plan on modifying this backend? Y
    

Conclusion

You have initialized the Amplify project and are now ready to start adding features. In the next module, we will add an entire user authentication flow with just a few lines of code.

To view your Amplify project in the dashboard at any time, you can now run the following command:

amplify console
? Which site do you want to open? AWS console

Was this page helpful?

Add Authentication