AWS Mobile
Developer Guide

Get Started


The AWS Mobile CLI provides a command line experience that allows frontend JavaScript developers to quickly create and integrate AWS backend resources into their mobile apps.


  1. Sign up for the AWS Free Tier.

  2. Install Node.js with NPM.

  3. Install AWS Mobile CLI

    npm install -g awsmobile-cli
  4. Configure the CLI with your AWS credentials

    To setup permissions for the toolchain used by the CLI, run:

    awsmobile configure

    If prompted for credentials, follow the steps provided by the CLI. For more information, see provide IAM credentials to AWS Mobile CLI.

Set Up Your Backend

Need to create a quick sample React app? See Create a React App.

To configure backend features for your app

  1. In the root folder of your app, run:

    awsmobile init

    The init command creates a backend project for your app. By default, analytics and web hosting are enabled in your backend and this configuration is automatically pulled into your app when you initialize.

  2. When prompted, provide the source directory for your project. The CLI will generate aws-exports.js in this location. This file contains the configuration and endpoint metadata used to link your frontend to your backend services.

    ? Where is your project's source directory: src
  3. Respond to further prompts with the following values.

    ? Where is your project's distribution directory to store build artifacts: dist ? What is your project's build command: npm run-script build ? What is your project's start command for local test run: npm run-script start ? What awsmobile project name would you like to use: YOUR-APP-NAME-2017-11-10-15-17-48

After the project is created you will get a success message which also includes details on the path where the aws-exports.js is copied.

awsmobile project's details logged at: awsmobilejs/#current-backend-info/backend-details.json awsmobile project's access information logged at: awsmobilejs/#current-backend-info/aws-exports.js awsmobile project's access information copied to: src/aws-exports.js awsmobile project's specifications logged at: awsmobilejs/#current-backend-info/mobile-hub-project.yml contents in #current-backend-info/ is synchronized with the latest information in the aws cloud

Your project is now initialized.

Connect to Your Backend

AWS Mobile uses the open source AWS Amplify library to link your code to the AWS features configured for your app.

This section of the guide shows examples using a React application of the kind output by create-react-app or a similar tool.

To connect the app to your configured AWS features

In index.js (or in other code that runs at launch-time), add the following imports.

import Amplify from 'aws-amplify'; import aws_exports from './YOUR-PATH-TO/aws-exports';

Then add the following code.


Run Your App Locally

Your app is now ready to launch and use the default features configured by AWS Mobile.

To launch your app locally in a browser

In the root folder of your app, run:

awsmobile run

Behind the scenes, this command runs npm install to install the Amplify library and also pushes any backend configuration changes to AWS Mobile. To run your app locally without pushing backend changes you cou can choose to run npm install and then run npm start.

Anytime you launch your app, app analytics are gathered and can be visualized in an AWS console.

AWS Free Tier

Initializing your app or adding features through the CLI will cause AWS services to be configured on your behalf. The pricing for AWS Mobile services enables you to learn and prototype at little or no cost using the AWS Free Tier.

Next Steps

Deploy your app to the cloud

Using a simple command, you can publish your app's frontend to hosting on a robust content distribution network (CDN) and view it in a browser.

To deploy your app to the cloud and launch it in a browser

In the root folder of your app, run:

awsmobile publish

To push any backend configuration changes to AWS and view content locally, run awsmobile run. In both cases, any pending changes you made to your backend configuration are made to your backend resources.

By default, the CLI configures AWS Mobile Hosting and Streaming feature, that hosts your app on Amazon CloudFront CDN endpoints. These locations make your app highly available to the public on the Internet and support media file streaming

You can also use a custom domain for your hosting location.

Test Your App on Our Mobile Devices

Invoke a free remote test of your app on a variety of real devices and see results, including screen shots.

To invoke a remote test of your app

In the root folder of your app, run:

awsmobile publish --test

The CLI will open the reporting page for your app in the Mobile Hub console to show the metrics gathered from the test devices. The device that runs the remote test you invoke resides in AWS Device Farm which provides flexible configuration of tests and reporting.

Add Features

Add the following AWS Mobile features to your mobile app using the CLI.

Learn more

To learn more about the commands and usage of the AWS Mobile CLI, see the AWS Mobile CLI reference.

Learn about AWS Mobile Amplify.