New AWS Mobile Services
The Mobile App Development Challenge
We want to make it easier for you to build sophisticated cloud-powered applications for mobile devices! User expectations are at an all-time high: they want to run your app on the device of their choice, they want it to be fast and efficient, and they want it to be secure. Here are some of the challenges that you will face as you strive to meet these expectations:
- Authenticate Users – Manage users and identity providers.
- Authorize Access – Securely access cloud resources.
- Synchronize Data – Sync user preferences across devices.
- Analyze User Behavior – Track active users and engagement.
- Manage Media – Store and share user-generated photos and other media items.
- Deliver Media – Automatically detect mobile devices and deliver content quickly on a global basis.
- Send Push Notifications – Keep users active by sending messages reliably.
- Store Shared Data – Store and query NoSQL data across users and devices.
- Stream Real-Time Data – Collect real-time clickstream logs and react quickly.
Meeting the Challenge
Today we are introducing three new AWS products and services to help you to meet these challenges.
Amazon Cognito simplifies the task of authenticating users and storing, managing, and syncing their data across multiple devices, platforms, and applications. It works online or offline, and allows you to securely save user-specific data such as application preferences and game state. Cognito works with multiple existing identity providers and also supports unauthenticated guest users.
Amazon Mobile Analytics will help you to collect, visualize, and understand app usage, engagement, and revenue at scale. Analytics can be collected via the AWS Mobile SDK or a set of REST APIs. Metrics are available through a series of reporting tabs in the AWS Management Console.
The updated and enhanced AWS Mobile SDK is designed to help you build high quality mobile apps quickly and easily. It provides access to services specifically designed for building mobile apps, mobile-optimized connectors to popular AWS data streaming, storage and database services, and access to a full array of other AWS services. This SDK also includes a common authentication mechanism that works across all of the AWS services, client-side data caching, and intelligent conflict resolution. The SDK can be used to build apps for devices that run iOS, Android, and Fire OS.
Taken as a whole, these services will help you to build, ship, run, monitor, optimize, and scale your next-generation mobile applications for use on iOS, Android, and Fire OS devices. The services are part of the full lineup of AWS compute, storage, database, networking, and analytics services, which are available to you and your users from AWS Regions location in the United States, South America, Europe, and Asia Pacific.
Here is how the new and existing AWS services map to the challenges that I called out earlier:
- Authenticate Users – Amazon Cognito (Identity Broker)
- Authorize Access – AWS Identity and Access Management (IAM)
- Synchronize Data – Amazon Cognito (Sync)
- Analyze User Behavior – Amazon Mobile Analytics
- Manage Media – Amazon Simple Storage Service (Amazon S3) Transfer Manager
- Deliver Media – Amazon CloudFront (Device Detection)
- Send Push Notifications – Amazon Simple Notification Service (Amazon SNS) Mobile Push
- Store Shared Data – Amazon DynamoDB (Object Mapper)
- Stream Real-Time Data – Amazon Kinesis (Kinesis Recorder)
Let’s take a closer look at each of the new services!
Amazon Cognito helps you identify unique users, retrieve temporary, limited-privilege AWS credentials and also offers data synchronization services.
As you might know, an Identity Provider is an online service that is responsible for issuing identification information for users that would like to interact with the service or with other cooperating services. Cognito is designed to interact with three major identity providers (Amazon, Facebook, and Google). You can take advantage of the identification and authorization features provided by these services instead of having to build and maintain your own. You no longer have to worry about recognizing users or storing and securing passwords when you use Cognito.
Cognito also supports guest user access. In conjunction with AWS Identity and Access Management (IAM) and with the aid of the AWS Security Token Service, mobile users can securely access AWS resources and app features, and even save data to the cloud without having to create an account or log in. However, if they choose to do this later, Cognito will merge data and identification information if the user ultimately decides to log in. Here’s how it all fits together:
Here’s what you need to do to get started with Cognito:
- Sign up for an AWS Account.
- Register your app on the identity provider’s console and get the app ID or token. This is an optional step; you can also choose to use only unauthenticated identities
- Create a Cognito identity pool in the Management Console.
- Integrate the AWS Mobile SDK; store and sync data in a dataset.
You can create and set up the identity pool in the Console:
Once your application is published and in production, you can return to the Console and view the metrics related to the pool:
Let’s talk about Cognito’s data synchronization facility! The client SDK manages a local SQLite store so that the application can work even when it is not connected. The store functions as a cache and is the target of all read and write operations. Cognito’s sync facility compares the local version of the data to the cloud version, and pushes up or pulls down deltas as needed. By default, Cognito assumes that the last write wins. You can override this and implement your own conflict resolution algorithm if you’d like. There is a small charge for each sync operation.
Each identity within a particular identity pool can store multiple datasets, each comprised of multiple key/value pairs:
Each dataset can grow to 1 MB and each identity can grow up to 20 MB.
You can create or open a dataset and add key/value pairs with a couple of lines of code:
DataSet *dataset = [syncClient openOrCreateDataSet:@"myDataSet"]; NSString *value = [dataset readStringForKey:@"myKey"];[dataset putString:@"my value" forKey:@"myKey"];
Charges for Cognito are based on the total amount of application data stored in the cloud and the number of sync operations performed on the data. The Amazon Cognito Free Tier provides you with 10 GB of sync store and 1,000,000 sync operations per month for the first 12 months of usage. Beyond that, sync store costs $0.15 per GB of storage per month and $0.15 for each 10,000 sync operations.
Once you have built your app, you need to track usage and user engagement, improving and fine-tuning the app and the user interaction in response to user feedback. The Amazon Mobile Analytics service will give you the information and the insights that you need to have in order to do this.
Using the raw data (“events”) collected and uploaded by your application, Amazon Mobile Analytics automatically calculated and updates the following metrics:
- Daily Active Users (DAU), Monthly Active Users (MAU), and New Users
- Sticky Factor (DAU divided by MAU)
- Session Count and Average Sessions per Daily Active User
- Average Revenue per Daily Active User (ARPDAU)
- and Average Revenue per Paying Daily Active User (ARPPDAU)
- Day 1, 3, and 7 Retention
- Week 1, 2, and 3 Retention
- Custom Events
In order for your application to be able to upload events, you can create an identity pool and use the AWS Mobile SDK (or the REST API) to call the appropriate reporting functions. There are three types of events:
- System – Start or end of a session
- In-App Purchase – Transaction.
- Custom – Specific actions within your application.
When you use the AWS Mobile SDK, the system events denoting the start and end of each session are sent automatically. Your application code is responsible for sending the other types of events at the appropriate time.
All of the metrics are available from within the AWS Management Console, broken down by tab:
The main page includes plenty of top-level information about your app and your users:
You can click on a tab to learn even more:
You can also filter by application, date range, and/or platform, as needed:
Pricing is based on the number of events that your app generates each month. The first 100 million events are free; beyond that, you will be charged $1.00 for each million events.
AWS Mobile SDK
Last, but definitely not least, I would like to say a few words about the updated and expanded AWS Mobile SDK! This SDK makes it easy for you to build applications for devices that run the iOS, Android, or Fire OS operating systems.
Here are some of the new features:
Object Mapper – A new DynamoDB Object Mapper for iOS makes it easy for you to access DynamoDB from your mobile apps. It enables you to map your client-side classes to Amazon DynamoDB tables without having to write the code to transform objects into tables and vice versa. The individual object instances map to items in a table, and they enable you to perform various create, read, update, and delete (CRUD) operations on items, and to execute queries.
S3 Transfer Manager – Amazon S3 Transfer Manager makes it easy for you to upload and download files from Amazon S3 while optimizing for performance and reliability. Now you can pause, resume, and cancel file transfer using a simple API. We have rebuilt the iOS S3TransferManager to utilize BFTask. It has a clean interface, and all of the operations are now asynchronous.
Android and Fire OS Enhancements – In addition to support for the services announced in this post, the SDK now supports Amazon Kinesis Recorder for reliable recording of data streams on mobile devices, along with support for the most recent SQS, SNS, and DynamoDB features. It also allows active requests to be terminated by interrupting the proper thread.
iOS / Objective-C Enhancements – The SDK supports ARC and BFTask, and conforms to the best practices for the use of Objective-C. It also supports Cocoapods, and can be accessed from Apple’s new Swift language.
PS – Special thanks to my friend and colleague Jinesh Varia for creating the screen shots and diagrams in this post!