Get Started with AWS for Free
Create a Free AccountAWS Free Tier offers unlimited user authentication and ID generation, 10 GB of cloud sync storage and 1 million sync operations per month with Amazon Cognito.
Q: What is Amazon Cognito?
Amazon Cognito is a simple user-data synchronization and identity service that helps you securely manage and synchronize app data for your users across their mobile devices. You can create unique identifiers for your users through a number of public login providers (Amazon, Facebook, Google or any OpenID Connect compatible provider), or your own user identity system, and also support unauthenticated guests. You can save app data locally on the device allowing your apps to work even when the device is offline and then securely sync and save this data to the AWS cloud, and all of a user’s devices.
Q: Who should use Amazon Cognito?
Amazon Cognito is designed for mobile developers who want to authenticate users with popular public identity providers or support unauthenticated guest users and use the AWS Cloud to save and sync user data for their mobile apps.
Q: How do I start using Amazon Cognito?
You can use the getting started wizard in the AWS Management Console to get started with Amazon Cognito. If you do not have an Amazon Web Services account, you can create an account when you sign in to the console. Once you have created an identity pool in the console, you can download and integrate the AWS Mobile SDK with your app to quickly perform sync store actions through simple API calls. Alternatively you can call the Amazon Cognito server-side APIs directly, instead of using the SDK.
Q: Does Amazon Cognito expose server-side APIs?
Yes. Amazon Cognito exposes server-side APIs. You can create your own custom interface to Amazon Cognito by calling these APIs directly. The server-side APIs are described in the Developer Guide.
Q: What is an Identity Pool?
Identity pools are the containers Amazon Cognito uses to keep your apps’ end user identities organized. An identity pool can be associated with one or many apps. If you use two different identity pools for two apps then the same end user will have a different unique identifier in each Identity Pool.
Q: Is there a limit to the number of Identity Pools you can create?
You can create a maximum of 60 identity pools in each AWS account.
Q: Which platforms does Amazon Cognito support?
Support for Amazon Cognito is included in the optional AWS Mobile SDK, which is available for iOS, Android, Unity, and Kindle Fire. Cognito is also available in the AWS SDK for JavaScript.
Q: Do I have to use the AWS Mobile SDK?
No. Amazon Cognito exposes its control and data APIs as web services. You can implement your own client library calling the server-side APIs directly.
Q: Which public identity providers can I use with Amazon Cognito?
You can use Amazon, Facebook, Google and any other OpenID Connect compatible identity provider.
Q: How does the login flow work with public identity providers?
Your mobile app authenticates with the identity provider (IdP) using the provider’s SDK. Once the end user is authenticated with the IdP, the OAuth or OpenID Connect token returned from the IdP is passed by your app to Amazon Cognito, which returns a new Cognito ID for the user and a set of temporary, limited-privilege AWS credentials.
Q: What if I register and authenticate my own users?
Amazon Cognito can integrate with your existing identity system. With a simple API call you can retrieve a Cognito ID for your end users based on your own unique identifier for your users. Once you have retrieved the Cognito ID and OpenID Token Cognito provides, you can use the Cognito client SDK to access AWS resources and synchronize user data.
Q: How does Amazon Cognito help me access AWS services securely?
Amazon Cognito assigns your users a set of temporary, limited privilege credentials to access your AWS resources. You can use Amazon Cognito to securely access other AWS services from your mobile app without requiring your AWS account credentials. You can also use the unique identifier generated for your app users in your Identity and Access Management policies. For example you can create a policy for an S3 bucket that only allows a particular user access to their own folder.
Q: Does Amazon Cognito store users’ credentials?
No. Your app communicates directly with your own identity system or with the supported public identity provider (Amazon, Facebook, or Google) to authenticate users. Amazon Cognito does not receive or store user credentials (only the token received from the Identity Provider is stored by Amazon Cognito).
Q: Does Amazon Cognito receive or store confidential information about my users from the Identity Providers?
No. Amazon Cognito does not receive any confidential information (such as email address, friends list, etc.) from the identity providers.
Q: Do I still need my own backend authentication and identity systems with Amazon Cognito?
No. Amazon Cognito supports login through Amazon, Facebook and Google, as well as providing support for unauthenticated users. With Amazon Cognito you can support federated authentication, profile data sync store and AWS access token distribution without writing any backend code.
Q: What if I don’t want to force my users to log in?
Amazon Cognito supports the creation and token vending process for unauthenticated users as well as authenticated users. This removes the friction of an additional login screen in your app, but still enables you to use temporary, limited privilege credentials to access AWS resources.
Q: What are unauthenticated users?
Unauthenticated users are users who do not authenticate with your own identity system or with one of the supported Identity Providers (Amazon, Facebook, or Google).
Q: Does Amazon Cognito support separate identities for different users on the same device?
Yes. Amazon Cognito supports separate identities on a single device, such as a family iPad. Each identity is treated separately and you have complete control over how your app logs users in and out and how local and remote app data is stored.
Q: How do I store data associated with an Amazon Cognito identity?
You can programmatically create a data set associated with an Amazon Cognito identity and start saving data in the form of key/value pairs. The data is stored both locally on the device and in the Amazon Cognito sync store. Amazon Cognito can sync this data across all of the end user’s devices.
Q: What is the Amazon Cognito sync store?
The Amazon Cognito Sync store is a key/value pair store linked to an Amazon Cognito identity. There is no limit to the number of identities you can create in your identity pools and sync store. Each Amazon Cognito identity within the sync store has its own user information store.
Q: Is data saved directly to the Amazon Cognito sync store?
No. The optional AWS Mobile SDK saves your data to an SQLite database on the local device, this way the data is always accessible to your app. The data is pushed to the Amazon Cognito sync store by calling the synchronize() method and, if push synchronization is enabled, all other devices linked to an identity are notified of the data change in the sync store via Amazon SNS.
Q: How is data stored in the Amazon Cognito sync store?
Data associated with an Amazon Cognito identity are organized as key/value pairs. A key is a label e.g. “MusicVolume”, and a value e.g. “11”. Key/value pairs are grouped and categorized using data sets. Data sets are a logical partition of key/value pairs and the most granular entity used by Amazon Cognito to perform sync operations.
Q: What is the maximum size of a user information store within the Amazon Cognito sync store?
Each user information store can have a maximum size of 20MB. Each data set within the user information store can contain up to 1MB of data. Within a data set you can have up to 1024 keys.
Q: What kind of data can I store in a data set?
Both keys and values within a data set are alphanumeric strings. There is no limit to the length of the strings other than the total amount of values in a dataset cannot exceed 1MB. Binary data can be stored as a base64 encoded string as a value provided it does not exceed the 1MB limit.
Q: Why are data sets limited to 1MB?
Limiting the data set size to 1MB increases the chances of a synchronization task completing successfully even when bandwidth is limited without lots of retries that consume battery life and data plans.
Q: Are user identities and user information stores shared across developers?
No, a user identity and information store is tied to a specific AWS account. If there are multiple apps from different publishers on a particular device that use Amazon Cognito, each app will use the information store created by each publisher.
Q: How can I analyze and query the data stored in the Cognito Sync store?
With Cognito Streams, you can push sync store data to a Kinesis stream in your AWS account. You can then consume this stream and store the data in a way that makes it easy for you to analyze such as a Amazon Redshift database, an RDS instance you own or even an S3 file. We have published sample Kinesis consumer application to show how to store the updates data in Amazon Redshift.
Q: Why should I use Kinesis stream instead of a database export?
By streaming the data to Kinesis you can receive all of the history of changes to your datasets in real-time. This means you receive all the changes an end user makes to a dataset and gives you the flexibility to store this data in a tool of your choice.
Q: What if I already have data stored in Cognito?
When you enable the Kinesis stream feature you will be able to start a bulk publish. This process asynchronously sends all of the data currently stored in your Cognito sync store to the Kinesis stream you selected.
Q: What is the price of this feature?
Cognito pushes the data to a Kinesis stream you own. There is no difference in Cognito’s per-synchronization price if this feature is enabled. You will be charged Kinesis’ standard rates for your shards.
Q: How is data synchronized with Amazon Cognito?
You can programmatically trigger the sync of data sets between client devices and the Amazon Cognito sync store by using the synchronize() method in the AWS Mobile SDK. The synchronize() method reads the latest version of the data available in the Amazon Cognito sync store and compares it to the local, cached copy. After comparison, the synchronize() method writes the latest updates as necessary to the local data store and the Amazon Cognito sync store. By default Amazon Cognito maintains the last-written version of the data. You can override this behavior and resolve data conflicts programmatically. In addition, push synchronization allows you to use Amazon Cognito to send a silent push notification to all devices associated with an identity to notify them that new data is available.
Q: What is a silent push notification?
Amazon Cognito uses the Amazon Simple Notification Service (SNS) to send silent push notifications to devices. A silent push notification is a push message that is received by your application on a user's device that will not be seen by the user.
Q: How do I use push synchronization?
To enable push synchronization you need to declare a platform application using the Amazon SNS page in the AWS Management Console. Then, from the identity pool page in the Amazon Cognito page of the AWS Management Console, you can link the SNS platform application to your Cognito identity pool. Amazon Cognito automatically utilizes the SNS platform application to notify devices of changes.
Q: How are conflicts in the synchronization process handled?
By default Amazon Cognito maintains the last-written version of the data. You can override this behavior by choosing to respond to a callback from the AWS Mobile SDK which will contain both versions of the data. Your app can then decide which version of the data (the local one or the one in the Amazon Cognito sync store) to keep and save to the Amazon Cognito sync store.
Q: Does Amazon Cognito support data encryption?
Data is encrypted at rest in the Amazon Cognito sync store, and all identity data is transmitted over HTTPS. The unique Amazon Cognito identifier on the device is stored in the appropriate secure location. On iOS for example, the Cognito identifier is stored in the iOS keychain. User data is cached in a local SQLite database within the app’s sandbox. The identity data in the local cache is not encrypted unless you implement encryption in your app.
Q: What are the restrictions to user data access?
Access to each identity data in the Cognito sync store is only available through the temporary credentials Cognito delivers to your app specifically for the identity. Identities cannot access each other's data. Developer credentials, such as users you create in Identity and Access Management, have read and write access to all identity data.
Q: How much does Amazon Cognito cost?
Charges for Amazon Cognito are based on the total amount of app data stored in the Amazon Cognito sync store and the number of sync operations performed. With the AWS Free Tier, you receive 10GB of sync store and 1,000,000 sync operations in a month for up to 12 months. Beyond this it costs $0.15 per GB of sync store per month and $0.15 for each 10,000 sync operations.
Q: What is a sync operation?
When you call the synchronize() method using the AWS Mobile SDK, this counts as a sync operation. If you are calling the server APIs directly, a sync operation is initiated when a new sync session token is emitted and is completed with a successful write or a timeout of the session token. Whether you use the SDK synchronize() method or call the server API’s directly, sync operations are charged at the same rate.
Q: Is Amazon Cognito part of the AWS Free Tier?
Yes. As part of the AWS Free Tier, Amazon Cognito offers 10GB of sync store and 1,000,000 sync operations in a month for up to the first 12 months of usage.
Q: Does every write or read from the app count as a sync operation?
No. You decide when to call the synchronize() method. Every write or read from the device is to the local SQlite store. This way you are in complete control of your costs.
Q: What does push synchronization cost ?
Amazon Cognito utilizes Amazon SNS to send silent push notifications. There is no additional charge for using Amazon Cognito for push synchronization, but normal Amazon SNS rates will apply for notifications sent to devices.