63
© 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

Scaling your Mobile App Development in the Cloud - DevNexus

Embed Size (px)

Citation preview

Page 1: Scaling your Mobile App Development in the Cloud - DevNexus

© 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

Page 2: Scaling your Mobile App Development in the Cloud - DevNexus

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

Page 3: Scaling your Mobile App Development in the Cloud - DevNexus

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

Page 4: Scaling your Mobile App Development in the Cloud - DevNexus

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

Google

Firebase

Azure App Services

Page 5: Scaling your Mobile App Development in the Cloud - DevNexus

Let’s build an appMobile Hub Demo & Code Walkthrough

Page 6: Scaling your Mobile App Development in the Cloud - DevNexus

Screenshots of Sample Demo App

Page 7: Scaling your Mobile App Development in the Cloud - DevNexus

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);

}

Page 8: Scaling your Mobile App Development in the Cloud - DevNexus

Overview of AWS Mobile ServicesWhat is AWS for Mobile?

Page 9: Scaling your Mobile App Development in the Cloud - DevNexus

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

Page 10: Scaling your Mobile App Development in the Cloud - DevNexus

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

Page 11: Scaling your Mobile App Development in the Cloud - DevNexus

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

Page 12: Scaling your Mobile App Development in the Cloud - DevNexus

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

Page 13: Scaling your Mobile App Development in the Cloud - DevNexus

AWS Mobile Services

SDK - Support for Multiple App Types

UnityXamarin React Native (Beta)

iOS Android WindowsJavaScript

Page 14: Scaling your Mobile App Development in the Cloud - DevNexus

Get Started QuicklyMobile Hub

Page 15: Scaling your Mobile App Development in the Cloud - DevNexus

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

Page 16: Scaling your Mobile App Development in the Cloud - DevNexus

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

Page 17: Scaling your Mobile App Development in the Cloud - DevNexus

AWS Mobile Hub:

Enabling your App Development

Native Applications

Hybrid Applications

Web Applications

Objective-C, Swift

Web

View

Native Container

Page 18: Scaling your Mobile App Development in the Cloud - DevNexus

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

Page 19: Scaling your Mobile App Development in the Cloud - DevNexus

Mobile Backend

AWS Lambda,

Amazon API Gateway

Page 20: Scaling your Mobile App Development in the Cloud - DevNexus

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.

Page 21: Scaling your Mobile App Development in the Cloud - DevNexus

AWS Lambda Programming Model

Asynchronous processing

Synchronous

request-response

Publish-and-subscribe

messaging

Event Triggers

Queue-based

messaging

Supports multiple

languages

Page 22: Scaling your Mobile App Development in the Cloud - DevNexus

Let’s Dig DeepLooking at a Lambda Function

Page 23: Scaling your Mobile App Development in the Cloud - DevNexus

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

Page 24: Scaling your Mobile App Development in the Cloud - DevNexus

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

Page 25: Scaling your Mobile App Development in the Cloud - DevNexus

AWS Lambda Amazon API Gateway Amazon Cognito

Create your Serverless Microservices on AWS using

Page 26: Scaling your Mobile App Development in the Cloud - DevNexus

Amazon

API Gateway

Mobile Applications

Lambda microservices

Serverless Microservices as Mobile Backend

APIWeb Applications

Cognito

<Identity Management>

Page 27: Scaling your Mobile App Development in the Cloud - DevNexus

Storing DataAmazon DynamoDB

Page 28: Scaling your Mobile App Development in the Cloud - DevNexus

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

Page 29: Scaling your Mobile App Development in the Cloud - DevNexus

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.

Page 30: Scaling your Mobile App Development in the Cloud - DevNexus

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

Page 31: Scaling your Mobile App Development in the Cloud - DevNexus

Auth & Access ControlAmazon Cognito

AWS Identity and Access Management

Page 32: Scaling your Mobile App Development in the Cloud - DevNexus

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

Page 33: Scaling your Mobile App Development in the Cloud - DevNexus

Amazon Cognito Identity

Facebook

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

Page 34: Scaling your Mobile App Development in the Cloud - DevNexus

Amazon Cognito:

Comprehensive Support for Identity Use Cases

Page 35: Scaling your Mobile App Development in the Cloud - DevNexus

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

Page 36: Scaling your Mobile App Development in the Cloud - DevNexus

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

Page 37: Scaling your Mobile App Development in the Cloud - DevNexus

Amazon Cognito Identity and AWS Identity and Access

Management Variables

Page 38: Scaling your Mobile App Development in the Cloud - DevNexus

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

Page 39: Scaling your Mobile App Development in the Cloud - DevNexus

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

Page 40: Scaling your Mobile App Development in the Cloud - DevNexus

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

Page 41: Scaling your Mobile App Development in the Cloud - DevNexus

Voice and Chat botsAmazon Lex

Page 42: Scaling your Mobile App Development in the Cloud - DevNexus

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

Page 43: Scaling your Mobile App Development in the Cloud - DevNexus

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

Page 44: Scaling your Mobile App Development in the Cloud - DevNexus

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

Page 45: Scaling your Mobile App Development in the Cloud - DevNexus

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

Page 46: Scaling your Mobile App Development in the Cloud - DevNexus

User Engagement and AnalyticsAmazon Pinpoint

Amazon Mobile Analytics

Amazon Simple Notification Service

Page 47: Scaling your Mobile App Development in the Cloud - DevNexus

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

Page 48: Scaling your Mobile App Development in the Cloud - DevNexus

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)

Page 49: Scaling your Mobile App Development in the Cloud - DevNexus

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

Page 50: Scaling your Mobile App Development in the Cloud - DevNexus

Assume a Role with Cognito

Create an instance of your

Mobile Analytics Application

Amazon Mobile Analytics

Submitting Events: Android

Page 51: Scaling your Mobile App Development in the Cloud - DevNexus

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

Page 52: Scaling your Mobile App Development in the Cloud - DevNexus

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

Page 53: Scaling your Mobile App Development in the Cloud - DevNexus

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.

Page 54: Scaling your Mobile App Development in the Cloud - DevNexus

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

Page 55: Scaling your Mobile App Development in the Cloud - DevNexus

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!

Page 56: Scaling your Mobile App Development in the Cloud - DevNexus

Ensure App QualityAWS Device Farm

Page 57: Scaling your Mobile App Development in the Cloud - DevNexus

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

Page 58: Scaling your Mobile App Development in the Cloud - DevNexus

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

Page 59: Scaling your Mobile App Development in the Cloud - DevNexus

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

Page 60: Scaling your Mobile App Development in the Cloud - DevNexus

Summary AWS for Mobile

Page 61: Scaling your Mobile App Development in the Cloud - DevNexus

Great Mobile Apps Run on AWS

Page 62: Scaling your Mobile App Development in the Cloud - DevNexus

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

Page 63: Scaling your Mobile App Development in the Cloud - DevNexus

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/