Note aws-amplify 6 has been released. If you are looking for upgrade guidance click here
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.
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. |
AWS Amplify is available as aws-amplify
on npm.
To get started pick your platform from our Getting Started home page
If you are using default exports from any Amplify package, then you will need to migrate to using named exports. For example:
- 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:
- 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)]));
npm install -g @aws-amplify/cli
amplify codegen models
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:
- 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:
- 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:
- 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:
- import { Amplify } from 'aws-amplify';
- Amplify.configure(...);
- // ...
- Amplify.Auth.signIn(...);
+ import { Amplify, Auth } from 'aws-amplify';
+ Amplify.configure(...);
+ // ...
+ Auth.signIn(...);
@react-native-community/netinfo
@react-native-async-storage/async-storage
// React Native
yarn add aws-amplify amazon-cognito-identity-js @react-native-community/netinfo @react-native-async-storage/async-storage
npx pod-install
// Expo
yarn add aws-amplify @react-native-community/netinfo @react-native-async-storage/async-storage
AWS.credentials
and AWS.config
don’t exist anymore in Amplify JavaScript.aws-sdk@2.x
has been removed from Amplify@3.x.x
in favor of version 3 of aws-sdk-js. We recommend to migrate to aws-sdk-js-v3 if you rely on AWS services that are not supported by Amplify, since aws-sdk-js-v3 is imported modularly.If you can't migrate to aws-sdk-js-v3 or rely on aws-sdk@2.x, you will need to import it separately.
If you are using exported paths within your Amplify JS application, (e.g. import from "@aws-amplify/analytics/lib/Analytics"
) this will now break and no longer will be supported. You will need to change to named imports:
import { Analytics } from 'aws-amplify';
If you are using categories as Amplify.<Category>
, this will no longer work and we recommend to import the category you are needing to use:
import { Auth } from 'aws-amplify';
For more information on contributing to DataStore / how DataStore works, see the DataStore Docs
Custom domain endpoint for GraphQL API.
Optional region string used to sign the request to customEndpoint
. Effective only if customEndpoint
is
specified, and the auth mode is 'iam'.
Default auth mode for all the API calls to given service.
Required GraphQL endpoint, must be a valid URL string.
Optional region string used to sign the request. Required only if the auth mode is 'iam'.
Required REST endpoint, must be a valid URL string.
Optional region string used to sign the request with IAM credentials. If Omitted, region will be extracted from the endpoint.
Optional service name string to sign the request with IAM credentials.
Holds the device specific information along with it's id and name.
The AWSAuthUser object contains username and userId from the idToken.
Input type for configureAutoTrack
.
Input type for identifyUser
.
Options to be passed to the API.
A User ID associated to the current device.
Additional information about the user and their device.
Base type for service options.
Name of the REST API configured in Amplify singleton.
Options to overwrite the REST API call behavior.
Path of the REST API.
Additional data that may be returned from Auth APIs.
Data describing the dispatch of a confirmation code.
Constructs a confirmSignIn
input.
Constructs a confirmSignUp
input.
Constructs a deleteUserAttributes
input.
Denotes the medium over which a confirmation code was sent.
The AuthDevice object contains id and name of the device.
Constructs a forgetDevice
input.
Data encapsulating the next step in the Sign Up process
The parameters for constructing a Resend Sign Up code input.
Denotes the next step in the Reset Password process.
Only the portions of an Auth rule we care about.
Constructs a sendUserAttributeVerificationCode
request.
Base type for service options.
On iOS devices, setting this to true requests that the browser not share cookies or other browsing data between the authentication session and the user’s normal browser session. This will bypass the permissions dialog that is displayed your user during sign-in and sign-out but also prevents reuse of existing sessions from the user's browser, requiring them to re-enter their credentials even if they are already externally logged in on their browser.
On all other platforms, this flag is ignored.
The parameters for constructing a Sign Up input.
The optional parameters for the Sign Up process.
Denotes the next step in the Update User Attribute process.
Constructs a updatePassword
input.
Constructs a updateUserAttributes
input.
Constructs a updateUserAttributes
input.
The interface of a user attribute.
A user attribute key type consisting of standard OIDC claims or custom attributes.
Key/value pairs describing a user attributes.
Constructs a VerifyTOTPSetup
input.
refCount
tracks how many consumers have set state for a particular API to avoid it being cleared before all
consumers are done using it.
Category -> Action -> Custom State
Arbitrary key/value pairs that may be passed as part of certain Cognito requests
Holds data describing the dispatch of a confirmation code.
Holds the sign in details of the user.
Optional API key string. Required only if the auth mode is 'apiKey'.