Important: The following content applies if you are already using the AWS Mobile CLI to configure your backend. If you are building a new mobile or web app, or you're adding cloud capabilities to your existing app, use the new AWS Amplify CLI instead. With the new Amplify CLI, you can use all of the features described in Announcing the AWS Amplify CLI toolchain, including AWS CloudFormation functionality that provides additional workflows.
The awsmobile-CLI, built on top of AWS Mobile Hub, provides a command line interface for frontend JavaScript developers to seamlessly enable and configure AWS services into their apps. With minimal configuration, you can start using all of the functionality provided by the AWS Mobile Hub from your favorite terminal program.
The easiest way to install is using npm or yarn
npm install -g awsmobile-cli
or
yarn global add awsmobile-cli
-
Sign up for the AWS Free Tier to learn and prototype at little or no cost.
-
Configure the CLI with your AWS credentials
awsmobile configure
Check here for more details about configuration
To create a new Mobile Hub project and pull the project configuration into your app, run the following command on your terminal.
cd <your-app>
awsmobile init
Running this command enables your Mobile Hub project with two default features: (1) Analytics, for receiving the analytics sent from your app and (2) Hosting and Streaming for easily hosting your app in the cloud. The command also adds the AWS Amplify JavaScript library to your app so you can easily integrate Analytics, as well as other features provided by AWS. These features can easily be enabled using the awsmobile cli commands below.
The current set of commands supported by the awsmobile CLI are
Command | Description |
---|---|
awsmobile start | Starts an awsmobilejs project using one of our starter templates, sets up the backend mobile hub project in the cloud and pulls the aws-exports.js or awsconfiguration.json file |
awsmobile init | Initializes the current project with awsmobilejs features, sets up the backend mobile hub project in the cloud and pulls the aws-exports.js or awsconfiguration.json file |
awsmobile configure [aws] | Configures the aws access credentials and aws region for awsmobile-cli |
awsmobile configure project | Configures the attributes of your project for awsmobile-cli |
awsmobile pull | Retrieves the latest details of the backend Mobile Hub project, such as the access information file aws-exports.js or awsconfiguration.json |
awsmobile push | Updates the backend Mobile Hub project with the latest local developments |
awsmobile publish | Executes awsmobile push, then builds and publishes client-side application to S3 and Cloud Front |
awsmobile run | Executes awsmobile push, then executes the project's start command to test run the client-side application |
awsmobile console | Opens the web console of the backend Mobile Hub project |
awsmobile features | Shows available Mobile Hub project features, and allows them to be enabled/disabled |
awsmobile <feature> enable [--prompt] | Enables the feature with the defaults configuration, and --prompt for initial configuration settings |
awsmobile <feature> disable | Disables the feature |
awsmobile <feature> configure | Configures the definition of the objects in the feature |
awsmobile cloud-api invoke <apiname> <method> <path> [init] | Invokes the API for testing locally. This helps quickly test unsigned APIs in your local environment |
awsmobile delete | Deletes the Mobile hub project |
awsmobile help [cmd] | Displays help for [cmd] |
Supported Features:
- user-signin (Cognito)
- user-files (AWS S3)
- cloud-api (CloudLogic)
- database (Dynamo DB)
- analytics (Pinpoint)
- hosting (S3 and CloudFront Distribution)
awsmobile configure
- general
- per project
When you run awsmobile configure
outside of a valid awsmobilejs project, it sets the general configuration. The general configuration is applied when you run awsmobile init
or awsmobile start
command. And its values are copied as the initial per project configuration for the newly initialized project
When you run awsmobile configure
inside a valid awsmobilejs project, it sets the configuration for this project only. It does NOT change the general configuration or the configuration of other projects.
Go to the AWS Mobile Docs to learn more about the usage of the awsmobile-cli and some sample codes to get your app up and running.