Getting started with Amplify

  1. Home
  2. Docs
  3. Getting started with Amplify
  4. AWS Setup

AWS Setup

Lets integrates your React Native project with a back-end using AWS Amplify.

What is included in your AWS Amplify Project:

  • User authentication (AWS Cognito).
  • GraphQL API (AppSync)
  • Lambda function and Lambda Trigger function
  • Storage using Amazon S3.

Configuring this project

Setting up AWS Amplify Cli
You will need to configure your Amplify command line interface. click here to find out exactly how to do that.

Initialise the AWS Amplify project.
From command line at the root of your project run:
amplify init

You will be asked:

  • Enter a name for the environment (dev)
  • Choose your default editor
  • Select the authentication method you want to use with two options: AWS profile ,  AWS access keys.
  • Select AWS profile and select the profile you will like to use.

After doing this, you will be done with initialising ur project.

To see your resources available to push, run: 
amplify status
run the command bellow to push auth
amplify push auth
run the command bellow to push api
amplify push api

Before pushing functions, you need to:

  • Configure a new server app client for your function
  • Add environment variables for your functions.
  • Register a user in your react native app to access app client in your functions
  • delete created account in dynamoDB

Configure a server app client for your function
login to your amplify account
click on the search input, and enter cognito and cick on cognito under services 
click on Manage User Pools and select your already created userpool

Copy the pool id and paste it some where. (you will need it later)
After copying the pool id, click on App clients section
You need to add another app client. So click on that.

Give it which ever name you want.
Set your Auth Flows Configuration like in the image below:

After saving, you will have your App client id. You should also copy that and paste it somewhere.

Now we have the Pool id (cognito user pool id) and App client id copied and pasted somewhere.

Add environment variables for your functions
You will need to update the environment variables for the two lamda functions.
The variable names and values.
The values will be what you previously copied and saved. The app client id, pool id and the rest.
(note your choosen username(email) and password.)
(password must be a minimum of 8 characters with numbers)

– COGNITO_CLIENT_ID: <app-client-id>


– ADMIN_USER_USERNAME: <chosen-username>

– ADMIN_USER_PASSWORD: <chosen-password>

To do this, run the command
amplify update function

select any of the functions
then select Environment variables configuration
Then configure for each environment variable, the names and values as written above

Remember you need to repeat this process for the second function. 

And this is all. you can now push your functions by running the command:
amplify push function

Your app is ready to use.

Register a user in your react native app to access app client in your functions
You need to do this in order to give your functions access to app sync using access token from ur created app client.
Now go to your react native app and register a new user with ur chosen username(email) and chosen password you added as environment variables

delete created account from dynamoDB
Now search for dynamoDb in the search input on your account on the web

– Click on DynamoDB under services
– Select Tables section at the left, then explore items
– Select user and delete the newly created user from ur dynamoDb so it is not accessible to other users.

This is all. Your app is ready to use.