Category: AWS Mobile SDK

Export Amazon Mobile Analytics to Redshift Automatically

The user base for a successful mobile app or game can reach in to the hundreds of thousands, millions, or even tens of millions. In order to generate, manage, and understand growth at this scale, a data-driven approach is a necessity. The Amazon Mobile Analytics service can be a big help here. You can include the AWS Mobile SDK in your app, configure purchase and custom events, and then track usage metrics and KPIs in the AWS Management Console.

The built-in metrics include daily and monthly active users, new users, session and revenue information, and retention (see my blog post, New AWS Mobile Services, for more information and a complete list of metrics). The metrics are visible from within the AWS Management Console.

Beyond the Console
As your application becomes increasing successful, you may want to analyze the data in more sophisticated ways. Perhaps you want to run complex SQL queries on the raw data. Maybe you want to combine the data collected by the SDK with information that you captured from your backend or your website. Or, you might want to create a single, unified view of a user, even if they access the same app from more than one device.

Automatic Export to Amazon Redshift
Today we are giving you the ability to automatically export your mobile analytics event data to Amazon Redshift. This is in addition to the existing option to export the data to Amazon Simple Storage Service (S3) (the bucket is a waypoint between Amazon Mobile Analytics and Amazon Redshift; Auto Export to S3 is enabled when you Auto Export to Redshift).

To enable this feature, simply open up the Mobile Analytics Console and choose Auto Export to S3/Redshift from the menu:

Inspect the existing export settings and then click on Start Auto Export to Redshift:

The console will then ask you for the information that it needs to have in order to create the Amazon Redshift cluster:

You can choose to include attributes and metrics from your custom events and you can use Amazon CloudWatch to monitor the auto-export process:

You can also set the advanced options for the Amazon Redshift cluster:

When you are ready to go, simply click on the Create Export button:

This will start up a AWS CloudFormation stack that creates an Amazon Elastic Compute Cloud (EC2) instance, an Amazon Redshift cluster, and all of the other necessary AWS resources:

You can see the export configuration for each of your mobile apps in the Console:


Inside the Stack
You can visit the CloudFormation Console to learn more about the stack and its components. The EC2 instance and the Amazon Redshift cluster are launched within a freshly created VPC (Virtual Private Cloud) and can be accessed using the IP address(es) specified in the Advanced Options.

Because the S3 bucket serves as a waypoint, you can stop the export to Amazon Redshift at any time and then restart it again later. This will repopulate the cluster with all of the historical data that was already exported to S3.

You can visit the Redshift Console to learn more about your cluster:

Available Now
This feature is available now and you can start using it today. You will pay the usual charges for S3 storage, the EC2 instance, and the Amazon Redshift cluster. You can turn on the Auto Export feature from your Amazon Mobile Analytics Console. To learn more, visit the Mobile Analytics page and check out the documentation.


AWS Mobile SDK – General Availability of Version 2

Version 2 of the AWS Mobile SDK has been available in Developer Preview since early July (See my blog post, New AWS Mobile Services to learn more). During the Developer Preview, many developers used the AWS Mobile SDK in their apps and provided us with a lot of really good feedback.

Today we are wrapping up the Developer Preview and making the AWS Mobile SDK Generally Available. You can download it here and get started with the AWS Mobile Services.

We responded to the feedback that we received during the developer preview and made a number of improvements to the SDK. You can find the details in the release notes section ( iOS, Android). Here are some of the more significant improvements:

  1. The method count in the AWS Mobile SDK for Android has been reduced by 40% to 13K. This will reduce the size of the final APK and keeps you clear of Android’s limit on the number of methods.
  2. The SDK supports offline sync using Amazon Cognito. The SDK queues requests made when the device is offline. The requests (pending sync operations) are executed when internet connectivity is available. Details can be found here.
  3. The AWS Mobile SDK for iOS now includes support for pre-signed Amazon Simple Storage Service (S3) URLs. You can use these URLS to perform background transfers using the NSURLSession class.

To get started, take a look at the AWS Mobile SDK Getting Started Guide for iOS and the AWS Mobile SDK Getting Started Guide for Android. You can also take a look at the iOS Samples and the Android Samples on the AWS Labs GitHub repo.


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:

Let’s take a closer look at each of the new services!

Amazon Cognito
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:

  1. Sign up for an AWS Account.
  2. 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
  3. Create a Cognito identity pool in the Management Console.
  4. 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.

Take a look at the Cognito documentation (Android and iOS) to learn more about this and other features.

Mobile Analytics
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!