amplify-js Documentation

A declarative JavaScript library for application development using cloud services.

RAW Doc

File: README.md





Reporting Bugs / Feature Requests



Note
aws-amplify 6 has been released. If you are looking for upgrade guidance click here

⚠️ Deprecation Notice
All AWS Amplify JavaScript library versions other than v5 and v6 are deprecated.
Only v5.x.x and v6.x.x are actively supported. Versions v4 and below are deprecated. If you are using any version other than v5 or v6, we strongly recommend upgrading to v6 as soon as possible.

AWS Amplify is a JavaScript library for frontend and mobile developers building cloud-enabled applications

AWS Amplify provides a declarative and easy-to-use interface across different categories of cloud operations. AWS Amplify goes well with any JavaScript based frontend workflow and React Native for mobile developers.

Our default implementation works with Amazon Web Services (AWS), but AWS Amplify is designed to be open and pluggable for any custom backend or service.

Visit our [documentation site](https://docs.amplify.aws/) to learn more about AWS Amplify. Please see the [Amplify JavaScript](https://docs.amplify.aws/lib/q/platform/js/) page for information around the full list of features we support.

Features

Category AWS Provider Description
Authentication Amazon Cognito APIs and Building blocks to create Authentication experiences.
Analytics Amazon Pinpoint Collect Analytics data for your application including tracking user sessions.
REST API Amazon API Gateway Sigv4 signing and AWS auth for API Gateway and other REST endpoints.
GraphQL API AWS AppSync Interact with your GraphQL or AWS AppSync endpoint(s).
DataStore AWS AppSync Programming model for shared and distributed data, with simple online/offline synchronization.
Storage Amazon S3 Manages content in public, protected, private storage buckets.
Geo (Developer preview) Amazon Location Service Provides APIs and UI components for maps and location search for JavaScript-based web apps.
Push Notifications Amazon Pinpoint Allows you to integrate push notifications in your app with Amazon Pinpoint targeting and campaign management support.
Interactions Amazon Lex Create conversational bots powered by deep learning technologies.
PubSub AWS IoT Provides connectivity with cloud-based message-oriented middleware.
Internationalization --- A lightweight internationalization solution.
Cache --- Provides a generic LRU cache for JavaScript developers to store data with priority and expiration settings.
Predictions Various* Connect your app with machine learning services like NLP, computer vision, TTS, and more.
  • Predictions utilizes a range of Amazon's Machine Learning services, including: Amazon Comprehend, Amazon Polly, Amazon Rekognition, Amazon Textract, and Amazon Translate.

Getting Started

AWS Amplify is available as aws-amplify on npm.

To get started pick your platform from our Getting Started home page

Version Support

AWS Amplify JavaScript library v4 and below will end support on April 13, 2026, as documented in our AWS Amplify JavaScript library version support calendar.

Effective immediately, the AWS Amplify JavaScript library v4 and below will enter Maintenance Mode until April 13, 2026 after which it will receive no more updates. While in Maintenance Mode, the libraries will only receive updates for critical bug fixes and security vulnerabilities. Refer to Amplify Documentation for more information on the maintenance policy.

If you are using AWS Amplify JavaScript library v4 and below, we strongly recommend upgrading to the AWS Amplify JavaScript Library v6 before April 13, 2026.

Notice:

Amplify 6.x.x has breaking changes. Please see the breaking changes on our [migration guide](https://docs.amplify.aws/javascript/build-a-backend/troubleshooting/migrate-from-javascript-v5-to-v6/)

Amplify 5.x.x has breaking changes. Please see the breaking changes below:

  • If you are using default exports from any Amplify package, then you will need to migrate to using named exports. For example:

    diff
    - import Amplify from 'aws-amplify';
    + import { Amplify } from 'aws-amplify'
    
    - import Analytics from '@aws-amplify/analytics';
    + import { Analytics } from '@aws-amplify/analytics';
    // or better
    + import { Analytics } from 'aws-amplify';
    
    - import Storage from '@aws-amplify/storage';
    + import { Storage } from '@aws-amplify/storage';
    // or better
    + import { Storage } from 'aws-amplify';
  • Datastore predicate syntax has changed, impacting the DataStore.query, DataStore.save, DataStore.delete, and DataStore.observe interfaces. For example:

    diff
    - await DataStore.delete(Post, (post) => post.status('eq', PostStatus.INACTIVE));
    + await DataStore.delete(Post, (post) => post.status.eq(PostStatus.INACTIVE));
    
    - await DataStore.query(Post, p => p.and( p => [p.title('eq', 'Amplify Getting Started Guide'), p.score('gt', 8)]));
    + await DataStore.query(Post, p => p.and( p => [p.title.eq('Amplify Getting Started Guide'), p.score.gt(8)]));
  • Storage.list has changed the name of the maxKeys parameter to pageSize and has a new return type that contains the results list. For example:

    diff
    - const photos = await Storage.list('photos/', { maxKeys: 100 });
    - const { key } = photos[0];
    
    + const photos = await Storage.list('photos/', { pageSize: 100 });
    + const { key } = photos.results[0];
  • Storage.put with resumable turned on has changed the key to no longer include the bucket name. For example:

    diff
    - let uploadedObjectKey;
    - Storage.put(file.name, file, {
    -   resumable: true,
    -   // Necessary to parse the bucket name out to work with the key
    -   completeCallback: (obj) => uploadedObjectKey = obj.key.substring( obj.key.indexOf("/") + 1 )
    - }
    
    + let uploadedObjectKey;
    + Storage.put(file.name, file, {
    +   resumable: true,
    +   completeCallback: (obj) => uploadedObjectKey = obj.key
    + }
  • Analytics.record no longer accepts string as input. For example:

    diff
    - Analytics.record('my example event');
    + Analytics.record({ name: 'my example event' });
  • The JS export has been removed from @aws-amplify/core in favor of exporting the functions it contained.

  • Any calls to Amplify.Auth, Amplify.Cache, and Amplify.ServiceWorker are no longer supported. Instead, your code should use the named exports. For example:

    diff
    - import { Amplify } from 'aws-amplify';
    - Amplify.configure(...);
    - // ...
    - Amplify.Auth.signIn(...);
    
    + import { Amplify, Auth } from 'aws-amplify';
    + Amplify.configure(...);
    + // ...
    + Auth.signIn(...);

DataStore Docs

For more information on contributing to DataStore / how DataStore works, see the DataStore Docs


File: docs/README.md

Welcome to the API reference guide for Amplify JS v6. Here you will find API references and type definitions for the library.

Using this Website

This website is organized by the packages and export paths that we expose in the library.

Internal or reference types that you may encounter while interacting with the library are documented in the <Reference Types> directories.

Additional Resources

Additional resources for using the library are listed below.

How to Contribute

If you're running into trouble using the library or have a question, you can contact us using any of the resources below.

We welcome contributions to the library! If you'd like to contribute, please start with our contributing guidelines.


File: packages/storage/README.md

INTERNAL USE ONLY

This package contains the AWS Amplify Storage category and is intended for internal use only. To integrate Amplify into your app, please use aws-amplify.


File: packages/rtn-passkeys/example/README.md

This is a new React Native project, bootstrapped using @react-native-community/cli.

Getting Started

Note: Make sure you have completed the Set Up Your Environment guide before proceeding.

Step 1: Start Metro

First, you will need to run Metro, the JavaScript build tool for React Native.

To start the Metro dev server, run the following command from the root of your React Native project:

sh
# Using npm
npm start

# OR using Yarn
yarn start

Step 2: Build and run your app

With Metro running, open a new terminal window/pane from the root of your React Native project, and use one of the following commands to build and run your Android or iOS app:

Android

sh
# Using npm
npm run android

# OR using Yarn
yarn android

iOS

For iOS, remember to install CocoaPods dependencies (this only needs to be run on first clone or after updating native deps).

The first time you create a new project, run the Ruby bundler to install CocoaPods itself:

sh
bundle install

Then, and every time you update your native dependencies, run:

sh
bundle exec pod install

For more information, please visit CocoaPods Getting Started guide.

sh
# Using npm
npm run ios

# OR using Yarn
yarn ios

If everything is set up correctly, you should see your new app running in the Android Emulator, iOS Simulator, or your connected device.

This is one way to run your app β€” you can also build it directly from Android Studio or Xcode.

Step 3: Modify your app

Now that you have successfully run the app, let's make changes!

Open App.tsx in your text editor of choice and make some changes. When you save, your app will automatically update and reflect these changes β€”Β this is powered by Fast Refresh.

When you want to forcefully reload, for example to reset the state of your app, you can perform a full reload:

  • Android: Press the R key twice or select "Reload" from the Dev Menu, accessed via Ctrl + M (Windows/Linux) or Cmd ⌘ + M (macOS).
  • iOS: Press R in iOS Simulator.

Congratulations! :tada:

You've successfully run and modified your React Native App. :partying_face:

Now what?

  • If you want to add this new React Native code to an existing application, check out the Integration guide.
  • If you're curious to learn more about React Native, check out the docs.

Troubleshooting

If you're having issues getting the above steps to work, see the Troubleshooting page.

Learn More

To learn more about React Native, take a look at the following resources:


File: packages/rtn-passkeys/README.md

INTERNAL USE ONLY

This package contains AWS Amplify React Native utilities and is intended for internal use only. Please ensure this package is installed alongside aws-amplify and @aws-amplify/react-native. We do not advise using any exports from this package directly.


File: packages/react-native/example/README.md

This is an example app for developing and testing the react-native modules located at ../.

Getting Started

Note: Make sure you have completed the React Native - Environment Setup instructions till "Creating a new application" step, before proceeding.

Step 1: Start the Metro Server

First, you will need to start Metro, the JavaScript bundler that ships with React Native.

To start Metro, run the following command from the root of your React Native project:

bash
# using npm
npm start

# OR using Yarn
yarn start

Step 2: Start your Application

Let Metro Bundler run in its own terminal. Open a new terminal from the root of your React Native project. Run the following command to start your Android or iOS app:

For Android

bash
# using npm
npm run android

# OR using Yarn
yarn android

For iOS

bash
# using npm
npm run ios

# OR using Yarn
yarn ios

If everything is set up correctly, you should see your new app running in your Android Emulator or iOS Simulator shortly provided you have set up your emulator/simulator correctly.

This is one way to run your app β€” you can also run it directly from within Android Studio and Xcode respectively.


File: packages/react-native/README.md

INTERNAL USE ONLY

This package contains AWS Amplify React Native utilities and is intended for internal use only. Please ensure this package is installed alongside aws-amplify. We do not advise using any exports from this package directly.


File: packages/pubsub/README.md

This package contains the AWS Amplify PubSub category. For more information on using PubSub in your application please reference the Amplify Dev Center.


File: packages/predictions/README.md

This package contains the AWS Amplify Predictions category. For more information on using Predictions in your application please reference the Amplify Dev Center.


File: packages/notifications/README.md

INTERNAL USE ONLY

This package contains the AWS Amplify Notifications category and is intended for internal use only. To integrate Amplify into your app, please use aws-amplify.