scaling your mobile app development in the cloud - devnexus
TRANSCRIPT
© 2015, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Scaling your Mobile App
Development in the Cloud
Tara E. Walker
Technical Evangelist
Amazon Web Services
@taraw
What we will Discuss in this Session
• Cloud Enabled Mobile Dev• Benefits of Cloud Mobile Development
• Overview of Cloud Services Offerings
• Demo:
• AWS Mobile Hub and AWS Services
• Code Walkthrough
• AWS Mobile Services Overview
• Building Mobile apps using AWS
• Scenarios
• Key features
Benefits: Cloud Enabled Mobile Development
User Auth & Identity
Capabilities
Sign-up/Sign-in
User Data synchronization
Social Logins
Offload Logic Processing
Store app assets ex. media files
Upload/Download w/Caching
Mobile App Analytics
Artificial Intelligence
Voice Recognition
Facial Recognition
Text to Speech
Ease in add Push Notifications
Individuals
Groups of users
Device Testing
Getting Your Head In the CloudsOverview of Cloud Services for Mobile
PSA: I will NOT be making ANY Comparisons or
Reviews of the Cloud Platforms.
Only providing public info On Cloud Services Options
AWS Mobile Services
Firebase
Azure App Services
Let’s build an appMobile Hub Demo & Code Walkthrough
Screenshots of Sample Demo App
Code of Sample Demo App//User Sign In using Cognito User Pools
final View.OnClickListener listener = new View.OnClickListener() {
@Override
public void onClick(View v)
{
username = ViewHelper.getStringValue(activity,
EDIT_TEXT_USERNAME_ID);
password =
ViewHelper.getStringValue(activity, EDIT_TEXT_PASSWORD_ID);
final CognitoUser cognitoUser = cognitoUserPool.getUser(username);
cognitoUser.getSessionInBackground(
authenticationHandler);
}
};
//Initialize Lex Voice Client
private void initializeLexSDK() {
Log.d(TAG, "Lex Client");
AWSCredentialsProvider credentialsProvider = AWSMobileClient.defaultMobileClient()
.getIdentityManager().getUnderlyingProvider();
// Create Lex interaction client.
lexInteractionClient = new InteractionClient(context,
credentialsProvider,
Regions.fromName(currentBot.getRegion()),
currentBot.getBotName(),
currentBot.getBotAlias());
lexInteractionClient.setInteractionListener(interactionListener);
}
Overview of AWS Mobile ServicesWhat is AWS for Mobile?
AWS for Mobile App development
User authN and authZ
Analyze user behavior
Store and share media
Synchronize data
Deliver media
Amazon Cognito
(Sync)
Amazon Cognito
IAM
(access control)
Amazon S3
Amazon CloudFront
Store data
Amazon DynamoDB
Amazon RDS
Track retentionAmazon Pinpoint
Send push notificationsAmazon SNS Mobile Push
Amazon Pinpoint
Run server-side logic
AWS Lambda
Amazon API Gateway
Amazon Lex
Accept conversational input
Amazon Pinpoint
AWS Mobile SDKs
AWS Mobile Hub
Your mobile app
AWS Mobile Services:
Everything you need to build Mobile Apps
Mobile Quickstart
Mobile Hub
Mobile Backend
Serverless: Lambda & API Gateway
EC2
ECS
Scalable Data Storage
DynamoDB
Authorization & Access Control Cognito
Build Voice & Text ExperiencesAmazon Lex
Amazon Polly
User Engagement and Analytics
Mobile Analytics
Simple Notification Services
Simple Email Services
Pinpoint
Test on Real Devices
Device Farm
AWS Services for Mobile App Development
Cognito
Identity
Device FarmAWS Lambda
API Gateway
Simple Email
ServiceMobile Hub
Android SDK
iOS SDK
JavaScript SDK
DynamoDB
Amazon RDS
S3
CloudFront
Amazon EMR
Kinesis
Redshift
Mobile
Analytics
Mobile App
Development
Serverless
Backend
Identity
Management
Testing and
Dev tools
Data Storage and
Content
Mobile
Analytics
Email +
Push
Analytics and
Big Data
CodeCommit
CodeDeploy
CodePipeline
Cognito
Sync
Xamarin/.NET SDK
Architecture: System
Token exchange
Session storage
Dataset sync
Amazon
CloudFront
Amazon
S3 Amazon
DynamoDB
Amazon
RDS
Amazon
Mobile Analytics
Amazon
SNS
Amazon
Cognito
Amazon API
Gateway
AWS
Lambda
Amazon
EC2/Amazon
ECSSession data
Custom event attributes
Custom metrics
Routing
API Negotiation
Static content
Images
Video
Binary data
Uploads
virtual private cloud
Amazon
Lex
Conversational
input
AWS Mobile Services
SDK - Support for Multiple App Types
UnityXamarin React Native (Beta)
iOS Android WindowsJavaScript
Get Started QuicklyMobile Hub
Mobile Hub auto-provisions mobile services
AWS
IDENTITY AND ACCESS
MANAGEMENT
AMAZON
S3
AMAZON
CLOUDFRONT
AMAZON
COGNITO
AMAZON
Pinpoint
AMAZON
SNS
AWS
DEVICE FARM
AMAZON
DYNAMODB
AWS
LAMBDA
AMAZON
API GATEWAY
AWS Mobile Hub
Provisions AWS Services selected
Provides Working Sample Mobile projectMobile app project includes:
Xcode or Android Studio project
Uses your AWS resources
Example application code
Helper “Glue” code
Software development kits
Detailed integration instructions
AWS Mobile Hub:
Enabling your App Development
Native Applications
Hybrid Applications
Web Applications
Objective-C, Swift
Web
View
Native Container
Mobile Hub:
Enabling Enterprise mobile apps
Empower mobile workforces and customers to easily
complete tasks via their mobile devices that span multiple
line of business applications
New supporting Mobile Hub features
Email/password sign-in
SAML-based sign-in
SaaS connectors
Custom connectorsConversational bots
Mobile Backend
AWS Lambda,
Amazon API Gateway
AWS Lambda
Run your code without
managing infrastructure
Cost effective and
Efficient
Continuous Scaling and
Monitoring
Easy to develop
and deploy
Run code without provisioning or managing servers.
Pay only for the compute time you consume; No charge when not
running
Execute for virtually any type of application or backend service
Simple: Upload your code; Lambda runs & scale code with high
availability.
Automatically trigger from other AWS services or call directly from
web or mobile app.
AWS Lambda Programming Model
Asynchronous processing
Synchronous
request-response
Publish-and-subscribe
messaging
Event Triggers
Queue-based
messaging
Supports multiple
languages
Let’s Dig DeepLooking at a Lambda Function
Amazon API Gateway
Simplified API
developmentPerformance at Scale Security Controls Monitor & meter
API activity
Makes it easy for developers to create, publish, maintain, monitor,
and secure APIs at scale.
With a few clicks, create an API that acts as a “front door” for
applications to access data, business logic
Tie API functionality to back-end services from Amazon EC2, AWS
Lambda, or any Web app
Handles traffic management, authorization and access control,
monitoring, and API version managemen for processingconcurrent
API calls
Username
Password
Sign In
1. Request with
Bearer TokenAPI Endpoints
2. Context + Token
403: Denied
3. Policy Decision
403: Allowed
[Integration with Cognito User Pools]
API Gateway
Amazon API Gateway:
Authorize API access using API Gateway
Custom Authorizer
AWS Lambda Amazon API Gateway Amazon Cognito
Create your Serverless Microservices on AWS using
Amazon
API Gateway
Mobile Applications
Lambda microservices
Serverless Microservices as Mobile Backend
APIWeb Applications
Cognito
<Identity Management>
Storing DataAmazon DynamoDB
Amazon DynamoDB
Fast, Consistent
PerformanceHighly Scalable
Fine-grained
Access ControlFlexible
Fast and flexible NoSQL database service for applications
Provides consistent, single-digit millisecond latency at any scale
Fully managed cloud database supporting document and key-
value pair storage models
Flexible data model & reliable performance
AWS Lambda integration providing triggers enabling automatic
reaction to data changes
Great fit for mobile, web, gaming, ad tech, IoT
Amazon DynamoDB
No SQL Database
Access via Cognito assigned Role
Storing Data in Databases
Relational (RDS)
Create interfaces
REST/GraphQL/JSON-API
API Gateway, ELB/ALB- Common: ASG behind ELB
using RDS Multi-AZ
Platform HTTP calls- iOS: NSURLConnection,
NSURLSession, etc.
- Android: HttpClient(),
HttpGet(), etc.
Amazon DynamoDB:
State & User Preferences
Administrator
Push Notification
AWS
LambdaAmazon
Kinesis
Hash String Map
Hash String Map
Hash String Map
Amazon
DynamoDB
Amazon
SNS
Trigger
Amazon
Aurora
Auth & Access ControlAmazon Cognito
AWS Identity and Access Management
Identity is mission critical for your applications
SecurityRevenue
Generation
Application
Backbone
Know your users
Monitor engagement
with your application
Store and manage
user data
Personalize your users’
experiences
Protect sensitive data
Secure business-
critical processes
User Identity
Amazon Cognito Identity
Corporate
ID
Etc.
Sign in with
Your User Pools
You can easily and securely add sign-up
and sign-in functionality to your mobile and
web apps with a fully-managed service that
scales to support 100s of millions of users.
Federated Identities
Your users can sign in with third-party
identity providers, such as Facebook and
SAML providers, and you can control access
to AWS resources from your app.
SAML
Sign in
Username
Password
Submit
Or
Start as a
guest
Amazon Cognito:
Comprehensive Support for Identity Use Cases
Amazon Cognito User Pools: Comprehensive User Flows
Email or Phone
Number Verification
Forgot Password
User Sign-Up and
Sign-In
Require users to verify their email address or phone number prior to activating
their account with a one-time password challenge
Provide users the ability to change their password when they forget it with a
one-time password challenge
Allow users to sign up and sign in using an email, phone number, or username
(and password) for your application.
User Profile Data Enable users to view and update their profile data – including custom attributes
SMS Multifactor
AuthenticationRequire users to complete a second factor of authentication by inputting a
security code received via SMS as part of the sign-in flow
Customize these User Flows Using Lambda
Token Based
AuthenticationUse JSON Web Tokens (JWTs) based on OpenID Connect (OIDC) and OAuth 2.0
standards for user authentication in your backend
Amazon Cognito Federated Identity:
Federate with Third Party Identity Providers
Username
Password
Sign In
SAML
Identity Provider
Example: Active
Directory with ADFS
Amazon Cognito2. Get AWS credentials
API Gateway
Your APIsDynamoDB S3
Lambda
Amazon Cognito Identity and AWS Identity and Access
Management Variables
Amazon Cognito: Custom Auth Flow
Cognito User Pools
Custom Authentication Challenges(e.g., CAPTCHA, passworldless auth, custom 2nd factors)
1
2 5
6
3
4
Amazon Cognito: Custom User Flows Using Lambda Hooks
Category Lambda Hook Example Scenarios
Custom
Authentication
Flow
Define Auth Challenge Determines the next challenge in a custom auth flow
Create Auth Challenge Creates a challenge in a custom auth flow
Verify Auth Challenge Response Determines if a response is correct in a custom auth flow
Authentication
Events
Pre Authentication Custom validation to accept or deny the sign-in request
Post Authentication Event logging for custom analytics
Sign-Up
Pre Sign-up Custom validation to accept or deny the sign-up request
Post Confirmation Custom welcome messages or event logging for custom analytics
Messages Custom Message Advanced customization and localization of messages
Amazon Cognito:Importing Existing User
Import users into your Cognito user pool by uploading .csv files
Users will create a new password when they first sign-in
Each imported user must have an email address or a phone number
Voice and Chat botsAmazon Lex
Quality Text & Speech
Language UnderstandingBuilt-in integration
with AWS platformSeamlessly deploy
& scale
Easy
to useCost effective
Amazon LexAmazon Lex is a service for building conversational interfaces into any
application using voice and text.
Supply example phrases and Lex builds a complete natural language model
Easy-to-use console to guide through process of creating chatbot or building
conversational interfaces
No need to worry about provisioning hardware and managing infrastructure to power
your bot experience as engagement increases
Integration with AWS Services; Lambda, MobileHub, CloudWatch and can easily
integrate with other services including Amazon Cognito, and Amazon DynamoDB
No upfront costs or minimum fees. You are only charged for the text or speech requests
that are made
Amazon Lex:
Conversational Interfaces for Mobile Apps
User speaks or types
inputs into app
Mobile App Amazon Lex
Speech Recognition &
Natural Language
understanding
Integration with AWS Services
AWS Lambda:
Business Logic
Amazon Cognito:
Authentication
AWS CloudWatch
Monitoring
User input
Amazon Lex response
Polly TTS
Speech Text
Conversation Engine parses
user input and responds
…..
…..
DynamoDB
SNS
Utterances
Spoken or typed phrases that invoke
your intent
BookHotel
Intents
An Intent performs an action in
response to natural language user
input
Slots
Slots are input data required to fulfill
the intent
Fulfillment
Fulfillment mechanism for your intent
Amazon Lex:
Bot structure
Out of the box access control for your bot using AWS IAM
Securely consume data stored in Amazon DynamoDB or SaaS
applications like Salesforce
Test your bot-enabled apps using AWS Device Farm
Engage users with Amazon Pinpoint
Amazon Lex:
Integrate a bot with app using Mobile Hub
User Engagement and AnalyticsAmazon Pinpoint
Amazon Mobile Analytics
Amazon Simple Notification Service
Amazon Pinpoint
Mobile User Engagement Platform
Aims to empower customers by providing tools to …
Effectively engage users through personalized push notifications (Targeted notifications perform 3 times better than generic notifications)
Segment users based on frequency, recency and custom attributes
Optimize customer messaging via A/B testing
Measure and analyze campaign performance
Multi-channel user engagement
Mobile Engagement with Amazon Pinpoint
End-User Devices(via AWS Mobile SDK)
Amazon SNS
Amazon Mobile
Analytics
Push Notifications
App EventsData Analysis & Export
Engagement Messages
Amazon Pinpoint
Customer
Systems(via AWS SDK)
Marketers
(via Console)
Scalable and
generous free tier
Focus on metrics that matter.
Usage reports available within
60 minutes of receiving data
from an app.
Fast
Scale to billions of
events per day from
millions of users.
Own your data
Simply and cost-effectively collect and analyze your application usage data
Data collected are not
shared, aggregated,
or reused.
Amazon Mobile Analytics
Assume a Role with Cognito
Create an instance of your
Mobile Analytics Application
Amazon Mobile Analytics
Submitting Events: Android
Amazon SNS
Global and Fast
at Massive Scale
Use via Java, Python, PHP,
Node.js, Objective-C, or
.NET
Send Messages to Any
Device or Endpoint
Support for Multiple
Platforms or Frameworks
Send billions of messages
per day with minimal
latencies across the world
Send notifications via mobile
push, email, HTTP, or SMS; or
messages to Amazon SQS or
AWS Lambda
Fast, Flexible, Global Messaging to Any Device or Endpoint
Amazon SNS
Cross-Platform
Mobile Push
Internet
Apple APNS
Google GCM
Amazon ADM
Windows WNS and
MPNS
Baidu CP
With Amazon SNS, developers can send push notifications on multiple platforms
and reach mobile users around the world
Amazon SNS Mobile Push
Android Phones and Tablets
Apple iPhones and iPads
Kindle Fire Devices
Android Phones and Tablets in China
iOS
Windows Desktop and Windows Phone
Devices
Device
Carrier
Aggregator
Application
Amazon
SNS
98%
73%
99%
98%
Amazon SNS:
Deliver SMS Messages to 200+ Countries
Adaptive Routing Dynamically Picks Best Route to a Destination Phone Number
SNS always has three routes to reach a Phone Number and picks the best based on deliverability data.
Worldwide SMS
54
200+ Destination Countries and Connectivity to 1100+ Telecom Carriers
Most Connections are “One-Hop”, thereby reducing latency and improving deliverability
Default Opt-In
Frictionless support for Multi-Factor Authentication and One-Time Password use-cases
Optimal Treatment per Traffic Type
Transactional routes optimized for deliverability while Marketing routes optimized for cost
Cost Control
Per-message Price Threshold and AWS Account-level Spend Threshold
Outbound Messaging Only
Inbound message processing for Opt-Out (STOP) or Help (HELP) where required by law
6
Amazon SNS:
Local Restrictions Solved
Message:
11:30 AM
Message:
Gate change alert! Your
flight from Rio de Janeiro
(GIG) to Manaus (MAO)
on Brazilian Airlines flight
#2120 has changed. The
revised departure time
is…
From: NX SC 1223
To: 33 6 78 90 12 34
Envover: Bonjour!
• SMS cannot originate from a
standard number
• Amazon SNS switches
automatically to a ‘pre-approved’
delivery code
Carrier Restriction
France
• Character limit is 157, versus
the 160 world standard
• Amazon SNS concatenates to
ensure full delivery
Carrier Restriction
Brazil
• Promotional messages are
prohibited from 9 PM – 9 AM
• Amazon SNS buffers messages
till the promotional messaging
time window commences.
Carrier Restriction
India
From: 225-631
Don’t forget about
special deals this
summer!
• Transactional Messages require
a pre-registered communication
code
• Amazon SNS converts the
message source to a known
registered communication code
Carrier Restriction
India
From: LM-ADIDAS
Thank You. Your
order# 123ABC has
shipped!
Ensure App QualityAWS Device Farm
Test your apps with AWS Device Farm on real devices
Automated Testing
Test your apps in parallel
against a large collection of
physical devices in the
AWS Cloud
Remote Access
Gesture, swipe, and interact
with devices real time,
directly from your browser
Rich set of automation
Framework support
Automation
AWS Device Farm
AWS Device Farm:
Automated Testing
Choose apps, devices and
automation framework
Test your apps against a
choice of real phones and
tablets
Get test results that
pinpoints bugs and
performance issues
AWS Device Farm:
Remote Access
Select a device by attributes
such as make, model and
OS version
Device Farm displays the
device’s screen in your
browser
Gesture, swipe and
Interact with the device.
Reproduce customer issues
and test functionality
Summary AWS for Mobile
Great Mobile Apps Run on AWS
Effective Mobile Engagement at AWS Scale
Increase engagement using both mobile and non mobile data for
segmentation
Segment and
target
Message and
engage
Measure
improvement
Analyze user
behavior
Call To Action – Get Started with Mobile Services
AWS Documentation
Mobile: https://aws.amazon.com/mobile/
Serverless: https://aws.amazon.com/serverless/
Lex: https://aws.amazon.com/lex
AWS Mobile SDK
https://aws.amazon.com/mobile/sdk/
GitHub: Mobile Code Examples
https://github.com/awslabs?utf8=%E2%9C%93&q=mobile
Mobile Services Blog:
https://aws.amazon.com/blogs/mobile/