一个用于利用云服务开发应用程序的声明性 JavaScript 库。
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 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.
AWS Amplify is available as aws-amplify on npm.
To get started pick your platform from our Getting Started home page
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.
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/cliamplify codegen modelsStorage.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(...);
For more information on contributing to DataStore / how DataStore works, see the DataStore Docs
暂无开放 Issues,或尚未同步最近议题。