BERLIN 2015, Amazon Web Services, Inc. or its affiliates. All rights reserved
Build Your Mobile App Faster with AWS Mobile Services Jan Metzner AWS Solutions Architect @janmetzner Danilo Poccia AWS Technical Evangelist @danilop
What You ll Get Out of This Session What AWS offers for mobile application development Easier to architect your mobile application Write cross platform mobile applications with AWS services
We asked two questions to our mobile customers: What makes your mobile apps unique? Where are you spending most of your time?
We asked two questions to our mobile customers: What makes your mobile apps unique? Where are you spending most of your time?
How to build a mobile app today?
Authenticate users Manage users and identity providers Store and share media Store user-generated photos Media and share them Authorize access Securely access cloud resources Synchronize data Sync user prefs across devices Analyze User Behavior Track active users, Engagement, retention Run Business Logic Run stateless custom Code without managing servers Your Mobile App Deliver media Automatically detect mobile devices Deliver content quickly globally Send push notifications Bring users back to your app by sending messages reliably Store shared data Store and query fast NoSQL data across users and devices Stream real-time data Collect real-time clickstream logs and take actions quickly
Authenticate users Amazon Cognito (Identity Broker) Store and share media Amazon S3 Transfer Manager Authorize access AWS Identity and Access Management Synchronize data Amazon Cognito (Sync) Analyze User Behavior Amazon Mobile Analytics Run Business Logic AWS Lambda Your Mobile App AWS Mobile SDK Deliver media Amazon CloudFront (Device Detection) Send push notifications Amazon SNS Mobile Push Store shared data Amazon DynamoDB (Object Mapper) Stream real-time data Amazon Kinesis (Recorder)
Authenticate users: Amazon Cognito
Amazon Cognito Your App data is secure, available offline, and kept in sync between devices Cross-device and Cross-platform Sync Simplifies Identity and Access Management Implement security best practices Synchronize user s data across devices and platforms Guest Your own Auth Manage users as unique identities across identity providers Securely access all AWS services from Mobile device
Amazon Cognito Identity Joe Anna Bob Unique Identities Support Multiple Login Providers Easily integrate with major login providers for authentication. Unique Users vs. Devices Manage unique identities. Automatically recognize unique user across devices and platforms. Helps implement security best practices Securely access any AWS Service from mobile device. It simplifies the interaction with AWS Identity and Access Management Mobile Analytics S3 DynamoDB Kinesis Identity Providers Any Device Any Platform Any AWS Service
Amazon Cognito for Unauthenticated Identities Guest User Access Securely access AWS resources and leverage app features without the need to create an account or logging in Save Data to the Cloud Save app and device data to the cloud and merge them after login Visitor Preferences Guest Unique Identifier for Your Things Headless connected devices can also securely access cloud services. EC2 S3 DynamoDB Kinesis Cognito Store
Access Policy Restriction (Policy Variables) Allow Actions: S3 Get/Put operations Resource: Only to a specific part of bucket to that identity { "Effect": "Allow, "Action": ["s3:getobject", "s3:putobject ], "Resource": ["arn:aws:s3::: mybucket/amazon/snakegame/ ${cognito-identity.amazonaws.com:sub}"] }
Access Policy Restriction (Policy Variables) Allow Actions: DynamoDB write ops Resource: Only if your identity is in the hash key { } "Effect": "Allow", "Action": [ "dynamodb:putitem", "dynamodb:updateitem", "dynamodb:deleteitem ], "Resource": [ "arn:aws:dynamodb:<region>:<account>:table/<table>" ], "Condition": { "ForAllValues:StringEquals": { "dynamodb:leadingkeys": [ "${cognito-identity.amazonaws.com:sub}" ] } }
Synchronize data across devices : Amazon Cognito (Sync)
Cognito Cloud Save and Sync Store App Data, Preferences and State Save app and device data to the cloud and merge them after login Cross-device Cross-OS Sync Sync user data and preferences across devices with one line of code User Data Storage and Sync Identity pool k/v data Work Offline Data always stored in local SQLite DB first. Works seamlessly when intermittent or no connectivity No Backend Simple client SDK eliminates need for server side code Any Platform ios/android/fireos
Synchronize data across devices with Cognito Sync User Profiles across OS/devices/web State Transition (link multiple accounts) Sync Game States Across OS/devices
Authenticate users Amazon Cognito (Identity Broker) Store and share media Store user-generated photos Media and share them Authorize access AWS Identity and Access Management Synchronize data Amazon Cognito (Sync) Analyze User Behavior Track active users, Engagement, retention Run Business Logic Run stateless custom Code without managing servers Your Mobile App Deliver media Automatically detect mobile devices Deliver content quickly globally Send push notifications Bring users back to your app by sending messages reliably Store shared data Store and query fast NoSQL data across users and devices Stream real-time data Collect real-time clickstream logs and take actions quickly
Analyze User Behavior: Amazon Mobile Analytics
Amazon Mobile Analytics Easily collect, visualize and understand your app usage data at scale Fast Scalable and Generous Free Tier Own Your Data Focus on metrics that matter. Usage reports available within 60 minutes of receiving data from an app Scale to billions of events per day from millions of users. Data collected are not shared, aggregated, or reused
Key Business Metrics (with one line of code) 1. Monthly Active Users (MAU) 2. Daily Active Users (DAU) 3. New Users, 4. Daily Sessions, 5. Sticky Factor, 6. 1-Day Retention, 7. Avg. Revenue per DAU, 8. Daily Paying Users, 9. Avg. Paying DAU
Track Retention User retention is a key indicator to judge the outcome of a marketing campaign, new feature introduction, UX changes, app updates, etc. Mobile Analytics provide four charts to track daily or weekly rate of returning users, after first use of the app
Track Custom Events Get behavioral insights into app specific actions that your users take Reports provide a view of how often custom events occur. You can add further context with Attributes and Metrics, to each custom event Examples Track the number of Likes/Shares, per article, in a news app Number of songs played, per user session, in a music app In-app item popularity in a shopping app Understand player abort rates per level, in a game
Run custom queries
Authenticate users Amazon Cognito (Identity Broker) Store and share media Store user-generated photos Media and share them Authorize access AWS Identity and Access Management Synchronize data Amazon Cognito (Sync) Analyze User Behavior Amazon Mobile Analytics Run Business Logic Run stateless custom Code without managing servers Your Mobile App Deliver media Automatically detect mobile devices Deliver content quickly globally Send push notifications Bring users back to your app by sending messages reliably Store shared data Store and query fast NoSQL data across users and devices Stream real-time data Collect real-time clickstream logs and take actions quickly
Serverless Backend Optimized for Mobile
AWS Lambda Run your code in the cloud in response to events and scale without any servers to manage Zero Administration Auto Scaling (Never under or over provision) Bring Your Own Code Java Focus on business logic, not infrastructure. Upload your code; AWS Lambda handles everything else Lambda scales the infrastructure as needed to match the event rate and pay as you go Starting with JavaScript but later any language, Create threads and processes, run batch scripts or other executables,
How can you put AWS Lambda to work? Back-end service Data triggers Mobile/IoT Stream processing Indexing & synchronization
Case Study: Social Media Aggregation CommandPost is CMP.LY s patented Monitoring, Measurement & Insights (MMI) tool for managed social communications. Increase the amount of data processed while reducing(!) the resources (instances) required to do it
AWS Lambda Now Ready for Production at Scale Respond to events in real-time Map local functions to lambda functions from within the SDK S3 event notification s SNS events DynamoDB Streams Kinesis events Custom events Cognito events Target, Filter, and Route Amazon SNS Notifications Apply Custom Logic to User Preferences and Game State Java Support, CloudTrail integration, Enhanced metrics and logging via CloudWatch
Map local functions to invoke Lambda Functions synchronously Amazon Cognito Sync Dataset Maintain Intelligence in the cloud and not the device Amazon DynamoDB Table Chain multiple Functions or call them in Parallel Personalize your notification for every user SNS Push notification
Adding a Lambda Backend to your Mobile App is simple Initialize the LambdaFactory and define the Interface for the functions lambda = new LambdaInvokerFactory(context, Regions.US_WEST_2, provider); //interface @LambdaFunction(functionName="cloudFunction ) String localfunction(string nameinfo); Create/Upload the Lambda Function to the AWS Management Console exports.handler = function(event, context) { context.done(null, event + 'Lambda'); // SUCCESS with message }; Call synchronize on the dataset lambda.localfunction( Hello From ); // this will output Hello From Lambda
Authenticate users Amazon Cognito (Identity Broker) Store and share media Store user-generated photos Media and share them Authorize access AWS Identity and Access Management Synchronize data Amazon Cognito (Sync) Analyze User Behavior Amazon Mobile Analytics Run Business Logic AWS Lambda Your Mobile App AWS Mobile SDK Deliver media Automatically detect mobile devices Deliver content quickly globally Send push notifications Bring users back to your app by sending messages reliably Store shared data Store and query fast NoSQL data across users and devices Stream real-time data Collect real-time clickstream logs and take actions quickly
Mobile-optimized Connectors (AWS Mobile SDK) S3 Integrated AWS Mobile SDK Optimized for native OS AWS Mobile SDK Kinesis Multipart upload media Fault tolerant download Automatic retries Pause, resume, cancel functions Generic batching system handles intermittent network connection Optimize battery utilization DynamoDB
Store and share media: Amazon S3
Amazon S3 Connector: Transfer Manager S3 Connector Multipart upload media (photos, videos, audio) Fault tolerant download (e.g. assets) No backend required Automatic retries Pause, resume, cancel functions Optimized for native OS
Authenticate users Amazon Cognito (Identity Broker) Store and share media Amazon S3 Transfer Manager Authorize access AWS Identity and Access Management Synchronize data Amazon Cognito (Sync) Analyze User Behavior Amazon Mobile Analytics Run Business Logic AWS Lambda Your Mobile App AWS Mobile SDK Deliver media Amazon CloudFront (Device Detection) Send push notifications Bring users back to your app by sending messages reliably Store shared data Store and query fast NoSQL data across users and devices Stream real-time data Collect real-time clickstream logs and take actions quickly
Send Push Notifications: Amazon SNS Mobile Push
What Customers Told Us About Push Notifications Sending large-scale push notifications, cross-platform is still hard. Developers want to be able to reach their customers globally and across all devices.
Each platform works differently, and push gets even more complex as you scale to support millions of devices. Cloud App Platform Services Mobile Apps
Amazon SNS Mobile Push Apple APNS Google GCM ios Apple iphones and ipads Android Phones and Tablets New features: Delivery Metrics via CloudWatch Trigger Lambda Functions from SNS notifications Mac OS desktops Internet Amazon SNS Cross-platform Mobile Push Baidu CP Amazon ADM Android Phones and Tablets in China Kindle Fire Devices VoIP apps on ios devices Windows WNS and MPNS Windows Desktop and Windows Phone Devices With Amazon SNS, developers can send push notifications on multiple platforms and reach mobile users around the world
Authenticate users Amazon Cognito (Identity Broker) Store and share media Amazon S3 Transfer Manager Authorize access AWS Identity and Access Management Synchronize data Amazon Cognito (Sync) Analyze User Behavior Amazon Mobile Analytics Run Business Logic AWS Lambda Your Mobile App AWS Mobile SDK Deliver media Amazon CloudFront (Device Detection) Send push notifications Amazon SNS Mobile Push Store shared data Store and query fast NoSQL data across users and devices Stream real-time data Collect real-time clickstream logs and take actions quickly
Store Shared Data: Amazon DynamoDB
Amazon DynamoDB Connector: Object Mapper Simplifies access to Amazon DynamoDB in you app Map client-side classes to Amazon DynamoDB tables Removes the need to transform objects into tables and vice versa High Scores Joe 1500 Anna 800 Bob 750 Joe Anna Bob
Amazon DynamoDB: Example @DynamoDBTable(tableName = "Bookstore") public static class Book { private int id; Table: Bookstore private String isbn, title; Id isbn Title hardcover private Boolean hardcover; 1 22-22222 My First Book Yes 2 43-43234 My Favorite Book No 3 55-12345 My New Book Yes } @DynamoDBHashKey(attributeName = "id") public int getid() { } return id; public void setid(int id) { } this.id = id; @DynamoDBAttribute(attributeName="isbn") public String getisbn() { }... return isbn;
Amazon DynamoDB: Example // Build a book object Book book = new Book(); book.setid(17); book.setisbn("222-2222222222"); book.settitle("some Title"); book.sethardcover(true); // Save book object to dynmaodb mapper.save(book); // Update item and save object again book.settitle("updated Title"); book.sethardcover(false); mapper.save(book); // Load another book Book anotherbook = mapper.load(book.class,7);
Authenticate users Amazon Cognito (Identity Broker) Store and share media Amazon S3 Transfer Manager Authorize access AWS Identity and Access Management Synchronize data Amazon Cognito (Sync) Analyze User Behavior Amazon Mobile Analytics Run Business Logic AWS Lambda Your Mobile App AWS Mobile SDK Deliver media Amazon CloudFront (Device Detection) Send push notifications Amazon SNS Mobile Push Store shared data Amazon DynamoDB (Object Mapper) Stream real-time data Collect real-time clickstream logs and take actions quickly
Collect real-time click-stream data: Amazon Kinesis Mobile Connector
Amazon Kinesis Connector for Mobile Apps Integrated AWS Mobile SDK AWS Mobile SDK Amazon Kinesis Kinesis enabled Apps on EC2 S3 Redshift Generic batching system that handles intermittent network connection and also optimize battery utilization For sophisticated User Behavior Real-time Analysis
Authenticate users Amazon Cognito (Identity Broker) Store and share media Amazon S3 Transfer Manager Authorize access AWS Identity and Access Management Synchronize data Amazon Cognito (Sync) Analyze User Behavior Amazon Mobile Analytics Run Business Logic AWS Lambda Your Mobile App AWS Mobile SDK Deliver media Amazon CloudFront (Device Detection) Send push notifications Amazon SNS Mobile Push Store shared data Amazon DynamoDB (Object Mapper) Stream real-time data Amazon Kinesis (Recorder)
Example: Putting it all together (Demo)
Summary
Fully Integrated AWS Mobile SDK Common authentication mechanism across all services Automatically handle intermittent network connections Cross-platform Support: Android, ios, Fire OS Native SDKs optimized for Mobile OS, for example, uses the local offline caching architecture Reduced memory footprint; Pick and choose the service jars you need Continuously updated with latest platform enhancements ios Android JavaScript Unity Xamarin Download the latest versions of the SDKs
Get Started for Free! AWS Lambda Amazon Cognito Mobile Analytics SNS Mobile Push Free Tier : 1M free requests per month 400,000 GBseconds of compute time per month Free Tier (for first 12 months): 1 Million syncs/month + 10GB of storage for Amazon Cognito Free Tier: 100 Million events every month Free Tier: 1 Million push messages every month http://aws.amazon.com/mobile
Jan Metzner @janmetzner Danilo Poccia @danilop
BERLIN 2015, Amazon Web Services, Inc. or its affiliates. All rights reserved