75
© 2014 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified, or distributed in whole or in part without the express consent of Amazon.com, Inc. Cloud-powered モバイルアプリの構築 Amazon Cognito, Amazon Mobile Analytics, AWS SDK for Mobile Jinesh Varia 7/10/2014

AWS Summits 2014 AWS MobileServices JP

Embed Size (px)

DESCRIPTION

AWS Summits 2014 AWS MobileServices

Citation preview

  • 1. 2014 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified, or distributed in whole or in part without the express consent of Amazon.com, Inc. Cloud-powered Amazon Cognito, Amazon Mobile Analytics, AWS SDK for Mobile Jinesh Varia 7/10/2014

2. 3. Track Retention Manage users and identity providers Securely access cloud resources Sync user prefs across devices Track active users, engagement Manage funnels, Campaign performances Store user-generated photos Media and share them Automatically detect mobile devices Deliver content quickly globally Bring users back to your app by sending messages reliably Store and query fast NoSQL data across users and devices Collect real-time clickstream logs and take actions quickly Your Mobile App 4. AWS Amazon Cognito Amazon Mobile Analytics Amazon SNS Mobile Push Kinesis Connector DynamoDB Connector S3 Connector SQS ConnectorSES Connector AWS Global Infrastructure (10 Regions, Availability Zones, 51 Edge Locations) Core Building Block Services Mobile Optimized Connectors Mobile Optimized Services Your Mobile App, Game or Device App AWS Mobile SDK, API Endpoints, Management Console Compute Storage Networking Analytics Databases Integrated SDK 5. Amazon Cognito Amazon Mobile Analytics Amazon SNS Mobile Push Kinesis Connector DynamoDB Connector S3 Connector SQS ConnectorSES Connector User identity & data synchronization service Store any NoSQL data and also map mobile OS specific objects to DynamoDB tables Fast cross-platform Analytics & reporting Service Powerful Cross-platform Push notification service Recorder that can handle intermittent network connection Easily upload, download to S3 and also pause, resume, and cancel these operations Send email reliably from device Access distributed buffering and queuing service 6. AWS Mobile SDK Android, iOS, Fire OS ( Unity, PhoneGap, Cordova) Mobile OS 7. Track Retention Manage users and identity providers Securely access cloud resources Sync user prefs across devices Track active users, engagement Manage funnels, Campaign performances Store user-generated photos Media and share them Automatically detect mobile devices Deliver content quickly globally Bring users back to your app by sending messages reliably Store and query fast NoSQL data across users and devices Collect real-time clickstream logs and take actions quickly Your Mobile App 8. AWS Mobile SDK Amazon Mobile Analytics Amazon Cognito (Sync) AWS Identity and Access Management Amazon Cognito (Identity Broker) Amazon S3 Transfer Manager Amazon CloudFront (Device Detection) Amazon DynamoDB (Object Mapper) Amazon Kinesis (Recorder) Track Retention Amazon Mobile Analytics Amazon SNS Mobile Push Your Mobile App 9. : Amazon Cognito 10. Amazon Cognito Sync AWS ID Sync Sync ID ID Guest 11. ID ID Joe Anna Bob Any Device Any Platform Any AWS Service AWS Identity and Access Management (IAM) AWS ID ID Amazon Cognito Identity Mobile AnalyticsS3DynamoDBKinesis 12. Amazon Cognito ID Headless AWS Visitor Preferences Cognito Store Guest EC2 S3 DynamoDB Kinesis 13. : : Soundtracker Music Station Music Station OS Stations Music Albums 14. Cognito3 AWS Account AWS Management Console AWS Mobile SDK dataset AWS Management Console identitypool 15. : Amazon Cognito 16. Amazon Cognito Security AWS AWS Credentials Security Token Service Token Vending Machine EC2 S3 DynamoDB Kinesis 17. Amazon Cognito User ID (Temp Credentials) DynamoDB End Users Developer App w/SDK Access to AWS Services Cognito Identity Broker Login OAUTH/OpenID Access Token Cognito ID, Temp Credentials S3 Mobile Analytics Cognito Sync Store AWS Management Console Access Token Pool ID Role ARNs 18. : Amazon Cognito + AWS IAM + Fine-grained access control 19. Amazon Cognito (ID) Identitypool Identity Providers Pool of identities that share the same trust policy Access Policy Access to AWS Services identitypool Unauthenticated Identities authenticated identities AWS IAM Roles AWS Account Web Identity Federation S3 DynamoDB Get Delete Put 20. IAM Role {! "Effect":"Allow",! "Action":["s3:*"],! "Resource":"*"! }! ! {! "Effect": Deny",! "Action": ["dynamodb:*"],! "Resource": "*"! }! ! {! "Effect": "Allow",! "Action": [cognito-sync:*"],! "Resource": "*"! }! Allow Actions: All S3, Sync store Operations Resource: All resources within these services Deny Actions: All DDB Operations Resource: All resources 21. {! "Effect":"Allow",! "Action":["s3:PutObject","s3:GetObject","s3:DeleteObject",! !"s3:ListMultipartUploadParts","s3:AbortMultipartUpload"],! "Resource":"arn:aws:s3:::BUCKET_NAME/*"! } ! {! "Effect":"Allow",! "Action":["s3:ListBucket","s3:ListBucketMultipartUploads"],! "Resource":"arn:aws:s3:::BUCKET_NAME"! }! {! "Effect": "Allow",! "Action": ["dynamodb:GetItem", "dynamodb:Query", "dynamodb:PutItem"],! "Resource": [ "arn:aws:dynamodb:REGION:123456789:table/TABLE_NAME", ! ! "arn:aws:dynamodb:REGION:123456789:table/TABLE_NAME/ ! !index/INDEX_NAME" ]! }! ! Allow Actions: Certain operations Resource: One bucket, table .. 22. {! "Effect":"Allow,! "Action ["s3:PutObject","s3:GetObject","s3:DeleteObj ect,s3:ListMultipartUploadParts","s3:AbortMultipart Upload"],! "Resource":"arn:aws:s3:::BUCKET_NAME/Bob/*"! } ! {! "Effect":"Allow",! "Action":"s3:ListBucket",! "Resource":"arn:aws:s3:::BUCKET_NAME",! "Condition":{"StringLike":{"s3:prefix":Bob/"}}! }! {! "Effect":"Allow",! "Action":["s3:ListBucketMultipartUploads"],! "Resource":"arn:aws:s3:::BUCKET_NAME"! }! Allow Actions: Certain operations Resource: Within a bucket with specific prefix (user) 23. (Policy Variables) Allow Actions: All sync operations Resource: Only to that identity {! "Effect": "Allow,! "Action": ["s3:GetObject,"s3:PutObject],! "Resource": ["arn:aws:s3:::! !myBucket/amazon/snakegame/! !${cognito-identity.amazonaws.com:sub}"]! }! {! "Effect":"Allow",! "Action":"cognito-sync:*", ! "Resource":["arn:aws:cognito-sync:us-east-1: !123456789012:identitypool/! !${cognito-identity.amazonaws.com:aud}/identity/! !${cognito-identity.amazonaws.com:sub}/*"] ! }! Allow Actions: S3 Get/Put operations Resource: Only to a specific part of bucket to that identity 24. : Amazon Cognito (Sync) 25. OS 26. Amazon Cognito Sync User Data Storage and Sync Any Platform iOS/Android/FireOS OS SQLite DB k/v data Identity pool 27. Amazon Cognito Sync : SDKSQLite : SQLite : . : Cognito Local SQLite Cache 28. Amazon Cognito Sync AWS Account Identitypool Dataset Identity Identity Identity Dataset Dataset identitypool ID 1:n 1:n 1:n dataset.synchronize() DatasetDataset Key/Value 1:n 29. Amazon Cognito Sync AWS Account Identitypool Dataset Identity Identity Identity Dataset Dataset identitypool 1:n 1:n 1:n User preferences Developer has two apps: a game and a productivity app Game state Identitypool1 Productivity App Game App DatasetDataset Key/Value 1:n 30. Cognito Sync CredentialsProvider CognitoClient Datasetsynchronize Dataset provider = new CognitoCredentialsProvider(context, AWS_ACCOUNT_ID, ! ! ! ! ! !COGNITO_POOL_ID, COGNTIO_ROLE_UNAUTH, COGNITO_ROLE_AUTH);! ! cognito = new DefaultCognitoSyncClient(context, COGNITO_POOL_ID, provider);! dataset.synchronize(new SyncCallback(){..});! ! cognito.openOrCreateDataset(datasetName);! dataset.put(key, value);! 31. Cognito Sync AWSCognitoSyncClient Datasetsynchronize Dataset DataSet *dataset = [syncClient openOrCreateDataSet:@"myDataSet"]; NSString *value = [dataset readStringForKey:@"myKey"]; [dataset putString:@"my value" forKey:@"myKey"]; AWSCognitoSyncClient *syncClient = [[AWSCognitoSyncClient alloc] initWithConfiguration: configuration]; [dataset synchronize]; iOS 32. : 33. Track Retention Track active users, engagement Manage funnels, Campaign performances Store user-generated photos Media and share them Automatically detect mobile devices Deliver content quickly globally Bring users back to your app by sending messages reliably Store and query fast NoSQL data across users and devices Collect real-time clickstream logs and take actions quickly Your Mobile App Amazon Cognito (Sync) AWS Identity and Access Management Amazon Cognito (Identity Broker) 34. : Amazon Mobile Analytics 35. 36. AWS 37. Amazon Mobile Analytics 60 38. 3Mobile Analytics AWSCognito ID AWS Management Console AWS Management Console SDK Android/FireOS, iOS 39. 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 40. Track Retention UI Mobile Analytics 41. Track the number of Likes/Shares, per article, in a news app Understand player abort rates per level, in a game Number of songs played, per user session, in a music app In-app item popularity in a shopping app 42. Cognito Analytics Initialize the AmazonMobileAnalyticsClient. Thats it! Get Session Activity in the AWS Management Console. For Custom Events activity reports, add events. Add OnResume() and OnPause() analytics = new AmazonMobileAnalytics(provider, context, "SnakeGameAWS);! EventClient eventClient = analytics.getEventClient();! MobileAnalyticsEvent visitEvent = eventClient.createEvent("speedSet");! eventClient.recordEvent(visitEvent);! analytics.getSessionClient().resumeSession();! analytics.getSessionClient().pauseSession();! Analytics.getEventClient().submitEvents();! 43. Cognito Analytics Initialize the AmazonMobileAnalytics object. Thats it! Get Session Activity in the AWS Management Console. Submit the event. If we don't call submitEvents, events will automatically be submitted at periodic intervals. Create add Custom Events [eventClient submitEvents];! id eventClient = analytics.eventClient;! id level1Event = [eventClient createEventWithEventType:@"level1Complete"];! AWSMobileAnalytics* analytics = [AWSMobileAnalytics ! !defaultAWSMobileAnalyticsWithIdentifier:@"someuniqueid"];! iOS 44. : 45. Store user-generated photos Media and share them Automatically detect mobile devices Deliver content quickly globally Bring users back to your app by sending messages reliably Store and query fast NoSQL data across users and devices Collect real-time clickstream logs and take actions quickly Your Mobile App Amazon Mobile Analytics Amazon Cognito (Sync) AWS Identity and Access Management Amazon Cognito (Identity Broker) Track Retention Amazon Mobile Analytics 46. : Amazon S3 47. Amazon S3 Connector: Transfer Manager S3 Connector ( ) (: ) OS 48. // Creating the transfer manager ! self.transferManager = [S3TransferManager new]; ! self.transferManager.s3 = s3client; ! ! // Upload image ! [self.transferManager uploadFile:fileName bucket:bucketName key:objectName]; ! ! // Download image ! [self.transferManager downloadFile:fileName bucket:bucketName key:objectName]; ! ! // Pause, Resume, Cancel ! [self.transferManager pauseAllTransfers]; ! [self.transferManager resumeAllTransfers]; ! [self.transferManager cancelAllTransfers]; ! Amazon S3 Connector: Transfer Manager 49. : 50. Bring users back to your app by sending messages reliably Store and query fast NoSQL data across users and devices Collect real-time clickstream logs and take actions quickly Your Mobile App Amazon Mobile Analytics Amazon Cognito (Sync) AWS Identity and Access Management Amazon Cognito (Identity Broker) Track Retention Amazon Mobile Analytics Amazon S3 Transfer Manager Amazon CloudFront (Device Detection) 51. AWS Mobile SDK Amazon Mobile Analytics Amazon Cognito (Sync) AWS Identity and Access Management Amazon Cognito (Identity Broker) Amazon S3 Transfer Manager Amazon CloudFront (Device Detection) Amazon DynamoDB (Object Mapper) Amazon Kinesis (Recorder) Track Retention Amazon Mobile Analytics Amazon SNS Mobile Push Your Mobile App 52. : Amazon SNS Mobile Push 53. 54. 55. Amazon SNSCross-platform Mobile Push InternetApple APNSGoogle GCMAmazon ADMWindows WNS and MPNSBaidu CP New! Amazon SNS, : Amazon SNS Mobile Push Android Phones and TabletsApple iPhones and iPadsKindle Fire DevicesAndroid Phones and Tablets in ChinaiOS Windows Desktop and Windows Phone Devices 56. : SNS E SNS Secret.ly Android SNS Jetpack Joyride Fruit ninja 57. Bring users back to your app by sending messages reliably Store and query fast NoSQL data across users and devices Collect real-time clickstream logs and take actions quickly Your Mobile App Amazon Mobile Analytics Amazon Cognito (Sync) AWS Identity and Access Management Amazon Cognito (Identity Broker) Track Retention Amazon Mobile Analytics Amazon S3 Transfer Manager Amazon CloudFront (Device Detection) 58. AWS Mobile SDK Amazon Mobile Analytics Amazon Cognito (Sync) AWS Identity and Access Management Amazon Cognito (Identity Broker) Amazon S3 Transfer Manager Amazon CloudFront (Device Detection) Amazon DynamoDB (Object Mapper) Amazon Kinesis (Recorder) Track Retention Amazon Mobile Analytics Amazon SNS Mobile Push Your Mobile App 59. : Amazon Kinesis Mobile Connector 60. Amazon Kinesis RedshiftS3Kinesis enabled Apps on EC2 AWS Mobile SDK Amazon Kinesis Connector for Mobile Apps AWS Mobile SDK 61. 62. Track Retention Manage users and identity providers Securely access cloud resources Sync user prefs across devices Track active users, engagement Manage funnels, Campaign performances Store user-generated photos Media and share them Automatically detect mobile devices Deliver content quickly globally Bring users back to your app by sending messages reliably Store and query fast NoSQL data across users and devices Collect real-time clickstream logs and take actions quickly Your Mobile App 63. AWS Mobile SDK Amazon Mobile Analytics Amazon Cognito (Sync) AWS Identity and Access Management Amazon Cognito (Identity Broker) Amazon S3 Transfer Manager Amazon CloudFront (Device Detection) Amazon DynamoDB (Object Mapper) Amazon Kinesis (Object Mapper) Track Retention Amazon Mobile Analytics Amazon SNS Mobile Push Your Mobile App 64. Amazon Cognito Amazon Mobile Analytics Amazon SNS Mobile Push Kinesis Connector DynamoDB Connector S3 Connector SQS ConnectorSES Connector AWS Global Infrastructure (10 Regions, Availability Zones, 51 Edge Locations) Your Mobile App, Game or Device App AWS Mobile SDK, API Endpoints, Management Console Compute Storage Networking Analytics Databases SDK 65. Amazon Cognito Amazon Mobile Analytics Amazon SNS Mobile Push Kinesis Connector DynamoDB Connector S3 Connector SQS ConnectorSES Connector AWS Global Infrastructure (10 Regions, Availability Zones, 51 Edge Locations) Core Building Block Services Mobile Optimized Connectors Mobile Optimized Services Your Mobile App, Game or Device App AWS Mobile SDK, API Endpoints, Management Console Compute Storage Networking Analytics Databases Integrated SDK 66. Amazon Cognito Amazon Mobile Analytics Amazon SNS Mobile Push : 100 (12): 100 syncs/ + 10GB Amazon Cognito : 1 ! 67. Thank You! Jinesh Varia @jinman [email protected] 68. Appendix.. 69. Simple and predictable pay as you go pricing Amazon Cognito Amazon Mobile Analytics Amazon SNS Mobile Push Free Tier: 1 Million push messages every month Thereafter: $0.50 for Million notifications delivered $0.50 for Million requests Free Tier (for first 12 months): 1 Million syncs/month + 10GB of storage for Amazon Cognito Thereafter: $0.15 for 10K Syncs $0.15 per GB for storage Free Tier: 100 Million events every month Thereafter: $1.00 per Million events