SlideShare une entreprise Scribd logo
1  sur  48
Télécharger pour lire hors ligne
©  2015,   Amazon   Web  Services,  Inc.   or  its  Affiliates.   All  rights  reserved.
Pierre  Gilot,  Solutions  Architect
Novembre 2015
Build  Scalable,  Serverless
Mobile  &  IoT Back  Ends  with  AWS  
Lambda
• A  brief  introduction  to  AWS  Lambda
• How  to  use  Amazon  Cognito  &  Amazon  Mobile  Analytics
• Build  an  Amazon  API  Gateway  and  AWS  Lambda  CRUD  
back  end  with  DynamoDB
• Leverage  AWS  Lambda  to  power  an  event-­driven  mobile  
back  end
• Push  and  alert  mobile  apps  through  Amazon  SNS
First,  a  little  bit  about  Lambda
AWS  Lambda
COMPUTE  
SERVICE
EVENT  
DRIVEN
Run  code  
without  thinking  
about  servers
Code  only  runs  
when  it  needs  to  
run
AWS  Lambda:  Benefits
EVENT-­DRIVEN  SCALESERVERLESS SUBSECOND  BILLING
AWS  Lambda:  Capabilities
BRING  YOUR  OWN  CODE COMPUTE  “POWER  LEVELS”
FLEXIBLE  INVOCATION  PATHS GRANULAR  PERMISSIONS  CONTROL  
AWS  Lambda:  How  it  works
AUTHOR CONFIGURE
DEPLOY LOG  AND  MONITOR
Multiple  ways  to  put  Lambda  to  work
AWS  
CloudFormation
custom  
resources
…  and  the  list  will  
continue  to  grow!
Amazon  Echo  
skills
Amazon  SWF  
tasks
Customized  
notifications  with  
Amazon  SNS
Amazon  Cognito  
triggers
Amazon  S3  
triggers
Amazon  
Dynamo  DB  
triggers
Amazon  
Kinesis  
processors
Microservices  
with  API  
Gateway
Cloud  back  end  for  mobile  apps
Back-­end  wish  list
What  it  does
User  administration
Content  storage
Push  notifications
Analyze  user  behavior
Custom  app  logic
How  it  behaves
Cost  follows  usage
Minimal  undifferentiated  heavy  lifting
Iterative  development
Reduced  time  to  market
Instant  scale
Reliable  and  secure
Amazon  Cognito
Authenticate   &  sync
Amazon  Mobile  Analytics
Analyze  user  behavior
AWS  Lambda
Run  business  logic
Amazon  S3
Amazon  DynamoDB
Store  content
Store  data
Amazon  SNS  mobile  push  
notifications
Send  push  notifications
Back-­end  architecture  on  AWS
Mobile  SDK
Amazon  API  Gateway
Sample  app:  “Find-­a-­Like”
• Premise:  Create  a  profile  with  interests  
and  get  notified  when  like-­minded  users  
are  nearby
• Functionalities:
• Create  a  profile  with  interests  and  upload  
content
• Track  location  continuously
• Notify  when  users  with  similar  interests  are  
close  by
• Log  and  analyze  app  usage
Let’s  think  in  layers
Create  profile,  upload  
content,  and  track  usage
Track  location  and  user  
interests
Match  and  alert  users
App-­centric
“You”
Activity-­centric  
“What  you  do”
User  base-­centric
“Them  &  me”
1
2
3
Create  a  profile,  upload  content,    
and  track  usage
1
Cognito
Mobile  Analytics
SNS  Mobile  Push
Kinesis  Recorder DynamoDB  Mapper S3  Transfer  Manager
SQS  Client
AWS  global  infrastructure  (regions,  Availability  Zones,  edge  locations)
Core  building  
block  services
Mobile-­optimized  
connectors
Your  mobile  app
AWS  Mobile  SDK (iOS,  Android,  Unity,  Xamarin)
Compute Storage Networking Analytics Databases
Integrated  SDK
Lambda
AWS  Mobile  SDKs
Security  model  for  AWS  API  calls
Mobile client
IAM PermissionsAWS Security
Token Service
1.  Request  token
2.  Receive  temporary  
credentials
3.  Sign  API  request  
with  temporary   token
AWS service APIs
4.  Make  API  request  
against  AWS   service   API
Authenticate  your  user:  Amazon  Cognito
• Generate  temporary  credentials  
and  enforce  rotation  to  limit  
credential  lifetime
• Authenticate  user  through  third-­party  
authentication  provider
• Unique  users  across  multiple
devices  and  identity  providers
• Allows  anonymous user  access
• Enables  security  best  practices  
through  IAM  roles
Use  Cognito  for  authentication  on  iOS
//Create and configure Cognito credentials provider
AWSCognitoCredentialsProvider *credentialsP = [AWSCognitoCredentialsProvider
credentialsWithRegionType:AWSRegionUSEast1
accountId:@"0123456789”
identityPoolId:@”us-east-1:beeeeeef-beef-beef-beef-beef”
unauthRoleArn:@"arn:aws:iam::0123456789:role/Unauth”
authRoleArn:@"arn:aws:iam::0123456789:role/Auth"];
//Set Cognito as default credentials provider for all AWS service calls
AWSServiceConfiguration *configuration = [AWSServiceConfiguration
configurationWithRegion:AWSRegionUSEast1
credentialsProvider:credentialsP];
[AWSServiceManager defaultServiceManager].defaultServiceConfiguration =
configuration;
Create  your  profile:  Cognito  Sync
• Create  your  app  profile  and  save  it  
locally in  the  Cognito  data  store
• Cognito  will  synchronize the  data  sets  
across  all  your  user’s  devices
• Cognito  data  sets  are  key/value  pairs
AWSCognito *syncClient = [AWSCognito defaultCognito];
AWSCognitoDataset *subs = [syncClient
openOrCreateDataset:@”UserProfile"];
[dataset setString:”Oli" forKey:@”name"];
[dataset setString:”50km" forKey:@”interestRadius"];
[dataset synchronize];
Upload  a  profile  picture:  S3  Transfer  Utility
• Amazon  S3  to  store  and  share  UGC  
directly from  the  mobile  device
• S3  Transfer  Utility  provides:
• Ability  to  continue  transferring  data  in  
the  background when  your  app  is  
not  running
• Ability  to  upload  binary  data  instead  
of  having  to  first  save  it  as  a  file  on  
the  device
Amazon S3
S3  Transfer  Utility:  iOS  code
NSData *dataToUpload = // The data to upload
AWSS3TransferUtility *transferUtility = [AWSS3TransferUtility
defaultS3TransferUtility];
[[transferUtility uploadData:dataToUpload
bucket:@"YourBucketName"
key:@"YourObjectKeyName"
contentType:@"text/plain"
expression:expression
completionHander:completionHandler]
continueWithBlock:^id(AWSTask *task) {
if (task.result) {
AWSS3TransferUtilityUploadTask *uploadTask = task.result;
// Do something with uploadTask
}
}
Track  app  usage:  Amazon  Mobile  Analytics
• Allows  you  to  collect,  visualize,  and  
understand  your  mobile  app  usage
• Scales  seamlessly  to  billions of  events  
per  day
• You  retain  full  control  and  ownership
of  the  data
Amazon Mobile
Analytics
AWSMobileAnalytics *analytics =
[AWSMobileAnalytics
mobileAnalyticsForAppId:@"yourAppId”
identityPoolId: @"cognitoId"];
Let’s  think  in  layers
Create  profile,  upload  
content,  and  track  usage
Track  location  and  user  
interests
Match  and  alert  users
App-­centric
“You”
Activity-­centric  
“What  you  do”
User  base-­centric
“Them  &  me”
1
2
3
Track  location  and  user  interests
2
How  to  collect  location  and  interests?
Back-­end  logic DatabaseMobile
“Location  Tracker”  and  “Interest”  microservice
Amazon  
Lambda
Amazon  API  
Gateway
Amazon  
DynamoDB
• /location
• /interests
• reportLocation()
• likeInterest()
• createInterest()
• listInterest()
Microservice
• location-­table
• interest-­table
Concepts  first:  Geohash
GeoHash is  a  lat/long  
geocode  system  that  
subdivides  space  into  
buckets  on  a  grid.
Can  be  numerical  
(e.g.6093522776912656
819)
Divide   the  planet  earth  
into  six  cells  
(A,B,C,D,E,F)  like  the  
six  faces  of  a  cube.
Divide   each  cell  into  
child  cells,  and  divide  
child  cells  into  more  
child  cells.  The  red  dot  
here  would  thus  be  
A224.
Works  with  
DynamoDB!
How  does  it  work?
Geo  library  for  Amazon  DynamoDB
• Java  library  to  easily  create and  query  
geospatial  data  in  DynamoDB using  GeoHashes
GeoPoint point = new GeoPoint(47.62, -122.34);
// find places 250m of Seattle’s Space Needle
QueryRadiusRequest request = new
QueryRadiusRequest(point, 250);
QueryRadiusResult result =
geoDataManager.queryRadius(request);
https://github.com/awslabs/dynamodb-­geo
Works  with  
Lambda!
Amazon  API  Gateway
• Fully  managed  and  scalable  RESTful
API  gateway  service
• Powered  through  our  content  
delivery  network  via  our  53  global  
edge  locations
• Provides DDoS protection  and  
throttling capabilities
• Multiple  API  stages  which  you  define  
(e.g.  dev,  test,  prod)
AWS Lambda
Amazon API
Gateway
Amazon
EC2
AWS API
On-­prem
server
When  to  choose  API  Gateway  vs.  direct  SDK?
• Amazon  API  Gateway  adds  an  additional  
layer  between  your  mobile  users  and  your  
logic  and  data  stores  in  order  to:
• Allow  back-­end  logic  to  be  interchanged
without  mobile  app  code  modifications
• Ability  to  throttle individual  users  or  requests
• Protect  against  DDoS attacks  including  
counterfeit  requests  (Layer  7)  and  SYN  floods  
(Layer  3)
• Provide  a  caching  layer  for  your  calls
Let’s  think  in  layers
Create  profile,  upload  
content,  and  track  usage
Track  location  and  user  
interests
Match  and  alert  users
App-­centric
“You”
Activity-­centric  
“What  you  do”
User  base-­centric
“Them  &  me”
1
2
3
Match  and  alert  users
3
DynamoDB
streams
Cognito  
Sync  trigger
S3  event  
notification
AWS  Lambda:  Event-­driven  compute
Find  a  proximity  match  based  on  interests
/location
REST  API
Profile  
(proximity  
setting)
Interest  table
AWS  SDK  call
reportLocation()
Invoke
findMatch()
DynamoDB Streams
GeoHash table
AWS  SDK  call
Interest  tablelikeInterest()
/interest
DynamoDB Streams  processor:  findMatch()
exports.handler = function(event, context) {
// Process all the records in the stream
event.Records.forEach(function(record) {
var newLocation = record.dynamodb.NewImage.geohash.S;
if (findProximityMatch(newLocation)) {
// Found match!
}
});
context.succeed();
};
We  found  a  match.  Now  what?
Amazon  SNS  mobile  push  notifications
• Amazon  SNS  is  a  fully  
managed,  cross-­platform  
mobile  push  intermediary  
service
• Fully  scalable  to  millions
of  devices
• Allows  you  to  create  
topics (e.g.  per  geo,  
interest,  usage  pattern,  
etc.)
Amazon SNS
Apple   APNS
Google   GCM
Amazon   ADM
Windows   WNS   and  
MPNS
Baidu   CP
Android  phones  and  tablets
Apple  iPhones  and  iPads
Kindle  Fire  devices
Android phones and tablets in China
iOS
Windows  phone  devices
Amazon  
SNS
Found  a  match:  Notify  user!
AWS  SDK  call
findMatch()
DynamoDB Streams
GeoHash table
Interest  table
Amazon  SNS
But  what  if  I  adjust  my  profile?
Interest  Radius
Cognito  Sync  Trigger  – AWS  Lambda  Code
exports.handler = function(event, context) {
if (event.eventType === 'SyncTrigger') {
event.datasetRecords.forEach(function(item) {
if (item.interestRadius.op == 'replace') {
// New interest radius set - process findMatch()
var params = {
FunctionName: 'findMatch',
InvocationType: 'Event', //makes it async
Payload: '{"user":'+ item.identityId +'}’};
lambda.invoke(params, function(err, data) {[..]});
}
}
}
context.succeed(event);
};
Let’s  think  in  Layers
Create  profile,  upload  
content  and  track  usage
Track  location  and  user  
interests
Match  and  alert  users
App-­centric
“You”
Activity-­centric  
“What  you  do”
User  base-­centric
“Them  &  me”
1
2
3
Mobile  AppMobile  
SDK
Amazon  
API  
Gateway
AWS  
Lambda
Amazon  
S3
Amazon
DynamoDB
Amazon  
Cognito
Amazon  Mobile
Analytics
Amazon  
SNS
Final  architecture
Recap  and  next  steps
Back-­end  wish  list:  ACHIEVED
What  it  does
User  administration
Content  storage
Push  notifications
Analyze  user  behavior
Custom  app  logic
How  it  behaves
Cost  follows  usage
Minimal  undifferentiated  heavy  lifting
Iterative  development
Reduced  time  to  market
Instant  scale
Reliable
More  to  explore
• Test  your  app  on  AWS  Device  Farm  
• Export  Amazon  Mobile  Analytics  data  to  Amazon  
Redshift
• Customize  your  notifications  with  SNS  +  
Lambda
• Watermark  your  pictures  using  S3  +  Lambda
Amazon  
Device  Farm
Amazon  
Redshift
Next  steps
1. Download  the  AWS  Mobile  SDK  and  create  your  first  
AWS-­backed  iOS  or  Android  app.
2. Go  to  console.aws.amazon.com/lambda  and  create  
your  first  Lambda  function.  (The  first  1M  requests  are  
on  us.)
3. Stay  up-­to-­date  with  AWS  Mobile  and  Lambda  on  the  
Mobile  blog  and  the  Compute  blog.
©  2015,   Amazon   Web  Services,  Inc.   or  its  Affiliates.   All  rights  reserved.
Pierre  Gilot,  Solutions  Architect
Novembre 2015
Thank  You!
Visit the  AWS  Compute blog,  or  the  
Lambda  forum  to  learn more  and  get
started.

Contenu connexe

Tendances

Tendances (20)

Mobile applicationdevelopment
Mobile applicationdevelopmentMobile applicationdevelopment
Mobile applicationdevelopment
 
Build Your Mobile App with AWS Mobile Services
Build Your Mobile App with AWS Mobile ServicesBuild Your Mobile App with AWS Mobile Services
Build Your Mobile App with AWS Mobile Services
 
Journey Through the Cloud - Social & Mobile Apps
Journey Through the Cloud - Social & Mobile Apps Journey Through the Cloud - Social & Mobile Apps
Journey Through the Cloud - Social & Mobile Apps
 
Deep-Dive: Building Native iOS and Android Application with the AWS Mobile SDK
Deep-Dive: Building Native iOS and Android Application with the AWS Mobile SDKDeep-Dive: Building Native iOS and Android Application with the AWS Mobile SDK
Deep-Dive: Building Native iOS and Android Application with the AWS Mobile SDK
 
Mobile App Development with Amazon Web Services Mobile Hub
Mobile App Development with Amazon Web Services Mobile HubMobile App Development with Amazon Web Services Mobile Hub
Mobile App Development with Amazon Web Services Mobile Hub
 
Engage your users with Amazon SNS Mobile Push (Now with Broadcast) - Jinesh V...
Engage your users with Amazon SNS Mobile Push (Now with Broadcast) - Jinesh V...Engage your users with Amazon SNS Mobile Push (Now with Broadcast) - Jinesh V...
Engage your users with Amazon SNS Mobile Push (Now with Broadcast) - Jinesh V...
 
Build Your Mobile App Faster with AWS Mobile Services
Build Your Mobile App Faster with AWS Mobile ServicesBuild Your Mobile App Faster with AWS Mobile Services
Build Your Mobile App Faster with AWS Mobile Services
 
Build Your Mobile App Faster with AWS Mobile Services
Build Your Mobile App Faster with AWS Mobile ServicesBuild Your Mobile App Faster with AWS Mobile Services
Build Your Mobile App Faster with AWS Mobile Services
 
Build Your Mobile App Faster with AWS Mobile Services (Cognito, Lambda, SNS, ...
Build Your Mobile App Faster with AWS Mobile Services (Cognito, Lambda, SNS, ...Build Your Mobile App Faster with AWS Mobile Services (Cognito, Lambda, SNS, ...
Build Your Mobile App Faster with AWS Mobile Services (Cognito, Lambda, SNS, ...
 
(MBL202) Mobile State of the Union: Mobile Apps Powered by AWS
(MBL202) Mobile State of the Union: Mobile Apps Powered by AWS(MBL202) Mobile State of the Union: Mobile Apps Powered by AWS
(MBL202) Mobile State of the Union: Mobile Apps Powered by AWS
 
AWS Mobile Hub Overview
AWS Mobile Hub OverviewAWS Mobile Hub Overview
AWS Mobile Hub Overview
 
AWS April Webinar Series - Easily Build and Scale Mobile Apps with AWS Mobile...
AWS April Webinar Series - Easily Build and Scale Mobile Apps with AWS Mobile...AWS April Webinar Series - Easily Build and Scale Mobile Apps with AWS Mobile...
AWS April Webinar Series - Easily Build and Scale Mobile Apps with AWS Mobile...
 
Journey Through the Cloud - Mobile & Social Apps
Journey Through the Cloud - Mobile & Social AppsJourney Through the Cloud - Mobile & Social Apps
Journey Through the Cloud - Mobile & Social Apps
 
AWS Mobile Hub - Building Mobile Apps with AWS
AWS Mobile Hub - Building Mobile Apps with AWSAWS Mobile Hub - Building Mobile Apps with AWS
AWS Mobile Hub - Building Mobile Apps with AWS
 
Day 2 - Delivering Media Mobile Apps Using the AWS Mobile & Javascript SDKs
Day 2 - Delivering Media Mobile Apps Using the AWS Mobile & Javascript SDKsDay 2 - Delivering Media Mobile Apps Using the AWS Mobile & Javascript SDKs
Day 2 - Delivering Media Mobile Apps Using the AWS Mobile & Javascript SDKs
 
Cloud-powered Cross-platform Mobile Apps on AWS
Cloud-powered Cross-platform Mobile Apps on AWSCloud-powered Cross-platform Mobile Apps on AWS
Cloud-powered Cross-platform Mobile Apps on AWS
 
Building Cloud-powered Mobile Apps
Building Cloud-powered Mobile AppsBuilding Cloud-powered Mobile Apps
Building Cloud-powered Mobile Apps
 
Integrating an App with Amazon Web Services SimpleDB - A Matter of Choices
Integrating an App with Amazon Web Services SimpleDB - A Matter of ChoicesIntegrating an App with Amazon Web Services SimpleDB - A Matter of Choices
Integrating an App with Amazon Web Services SimpleDB - A Matter of Choices
 
Amazon Cognito
Amazon CognitoAmazon Cognito
Amazon Cognito
 
Building Cloud-Powered Mobile Apps
Building Cloud-Powered Mobile AppsBuilding Cloud-Powered Mobile Apps
Building Cloud-Powered Mobile Apps
 

En vedette

Open Source Lambda Architecture with Hadoop, Kafka, Samza and Druid
Open Source Lambda Architecture with Hadoop, Kafka, Samza and DruidOpen Source Lambda Architecture with Hadoop, Kafka, Samza and Druid
Open Source Lambda Architecture with Hadoop, Kafka, Samza and Druid
DataWorks Summit
 

En vedette (20)

AWS Webcast - Build Mobile Apps with a Secure, Scalable Back End on DynamoDB
AWS Webcast - Build Mobile Apps with a Secure, Scalable Back End on DynamoDBAWS Webcast - Build Mobile Apps with a Secure, Scalable Back End on DynamoDB
AWS Webcast - Build Mobile Apps with a Secure, Scalable Back End on DynamoDB
 
How Parse Built a Mobile Backend as a Service on AWS (MBL307) | AWS re:Invent...
How Parse Built a Mobile Backend as a Service on AWS (MBL307) | AWS re:Invent...How Parse Built a Mobile Backend as a Service on AWS (MBL307) | AWS re:Invent...
How Parse Built a Mobile Backend as a Service on AWS (MBL307) | AWS re:Invent...
 
輕輕鬆鬆用 Nodejs 寫網路爬蟲
輕輕鬆鬆用 Nodejs 寫網路爬蟲輕輕鬆鬆用 Nodejs 寫網路爬蟲
輕輕鬆鬆用 Nodejs 寫網路爬蟲
 
Architecting for Scale using Microservices & Serverless Backends
Architecting for Scale using Microservices & Serverless BackendsArchitecting for Scale using Microservices & Serverless Backends
Architecting for Scale using Microservices & Serverless Backends
 
Geospatial Search With Amazon CloudSearch
Geospatial Search With Amazon CloudSearch Geospatial Search With Amazon CloudSearch
Geospatial Search With Amazon CloudSearch
 
Building Serverless Backends with AWS Lambda and Amazon API Gateway
Building Serverless Backends with AWS Lambda and Amazon API GatewayBuilding Serverless Backends with AWS Lambda and Amazon API Gateway
Building Serverless Backends with AWS Lambda and Amazon API Gateway
 
Build a Server-less Event-driven Backend with AWS Lambda and Amazon API Gateway
Build a Server-less Event-driven Backend with AWS Lambda and Amazon API GatewayBuild a Server-less Event-driven Backend with AWS Lambda and Amazon API Gateway
Build a Server-less Event-driven Backend with AWS Lambda and Amazon API Gateway
 
Serverless Geospatial Mobile Apps with AWS
Serverless Geospatial Mobile Apps with AWSServerless Geospatial Mobile Apps with AWS
Serverless Geospatial Mobile Apps with AWS
 
Introduction to building alexa skills and putting your amazon echo to work
Introduction to building alexa skills and putting your amazon echo to workIntroduction to building alexa skills and putting your amazon echo to work
Introduction to building alexa skills and putting your amazon echo to work
 
Open Source Lambda Architecture with Hadoop, Kafka, Samza and Druid
Open Source Lambda Architecture with Hadoop, Kafka, Samza and DruidOpen Source Lambda Architecture with Hadoop, Kafka, Samza and Druid
Open Source Lambda Architecture with Hadoop, Kafka, Samza and Druid
 
2016 - Serverless Microservices on AWS with API Gateway and Lambda
2016 - Serverless Microservices on AWS with API Gateway and Lambda2016 - Serverless Microservices on AWS with API Gateway and Lambda
2016 - Serverless Microservices on AWS with API Gateway and Lambda
 
(DAT201) Introduction to Amazon Redshift
(DAT201) Introduction to Amazon Redshift(DAT201) Introduction to Amazon Redshift
(DAT201) Introduction to Amazon Redshift
 
"Better, faster, stronger market fit" by Mike LaVigne, Co-founder & Head of P...
"Better, faster, stronger market fit" by Mike LaVigne, Co-founder & Head of P..."Better, faster, stronger market fit" by Mike LaVigne, Co-founder & Head of P...
"Better, faster, stronger market fit" by Mike LaVigne, Co-founder & Head of P...
 
Digital Workloads on AWS
Digital Workloads on AWSDigital Workloads on AWS
Digital Workloads on AWS
 
AWS Lambda in C#
AWS Lambda in C#AWS Lambda in C#
AWS Lambda in C#
 
Design Patterns For Real Time Streaming Data Analytics
Design Patterns For Real Time Streaming Data AnalyticsDesign Patterns For Real Time Streaming Data Analytics
Design Patterns For Real Time Streaming Data Analytics
 
1. 利用微服務架構建立雲端影音平台 (Building Media Platform by Microservices Architecture)
1.	利用微服務架構建立雲端影音平台 (Building Media Platform by Microservices Architecture)1.	利用微服務架構建立雲端影音平台 (Building Media Platform by Microservices Architecture)
1. 利用微服務架構建立雲端影音平台 (Building Media Platform by Microservices Architecture)
 
An Introduction to Using AWS and ASK to Build Voice Driven Experiences
An Introduction to Using AWS and ASK to Build Voice Driven ExperiencesAn Introduction to Using AWS and ASK to Build Voice Driven Experiences
An Introduction to Using AWS and ASK to Build Voice Driven Experiences
 
Convert Your Code into a Microservice using AWS Lambda
Convert Your Code into a Microservice using AWS LambdaConvert Your Code into a Microservice using AWS Lambda
Convert Your Code into a Microservice using AWS Lambda
 
AWS re:Invent 2016: Building Complex Serverless Applications (GPST404)
AWS re:Invent 2016: Building Complex Serverless Applications (GPST404)AWS re:Invent 2016: Building Complex Serverless Applications (GPST404)
AWS re:Invent 2016: Building Complex Serverless Applications (GPST404)
 

Similaire à Build a mobile app serverless with AWS Lambda

Social & Mobile Apps journey through the cloud
Social & Mobile Apps   journey through the cloudSocial & Mobile Apps   journey through the cloud
Social & Mobile Apps journey through the cloud
Ian Massingham
 
amazon-cognito-auth-in-minutes
amazon-cognito-auth-in-minutesamazon-cognito-auth-in-minutes
amazon-cognito-auth-in-minutes
Vladimir Budilov
 

Similaire à Build a mobile app serverless with AWS Lambda (20)

Serverless Geospatial Mobile Apps with AWS
Serverless Geospatial Mobile Apps with AWSServerless Geospatial Mobile Apps with AWS
Serverless Geospatial Mobile Apps with AWS
 
Serverless Geospatial Mobile Apps with AWS
Serverless Geospatial Mobile Apps with AWSServerless Geospatial Mobile Apps with AWS
Serverless Geospatial Mobile Apps with AWS
 
AWS re:Invent 2016: Deep-Dive: Native, Hybrid and Web patterns with Serverles...
AWS re:Invent 2016: Deep-Dive: Native, Hybrid and Web patterns with Serverles...AWS re:Invent 2016: Deep-Dive: Native, Hybrid and Web patterns with Serverles...
AWS re:Invent 2016: Deep-Dive: Native, Hybrid and Web patterns with Serverles...
 
Social & Mobile Apps journey through the cloud
Social & Mobile Apps   journey through the cloudSocial & Mobile Apps   journey through the cloud
Social & Mobile Apps journey through the cloud
 
Getting Started with AWS Lambda and the Serverless Cloud
Getting Started with AWS Lambda and the Serverless CloudGetting Started with AWS Lambda and the Serverless Cloud
Getting Started with AWS Lambda and the Serverless Cloud
 
Build a Website on AWS for Your First 10 Million Users
Build a Website on AWS for Your First 10 Million UsersBuild a Website on AWS for Your First 10 Million Users
Build a Website on AWS for Your First 10 Million Users
 
Mobile on AWS
Mobile on AWSMobile on AWS
Mobile on AWS
 
Build an App on AWS for Your First 10 Million Users
Build an App on AWS for Your First 10 Million UsersBuild an App on AWS for Your First 10 Million Users
Build an App on AWS for Your First 10 Million Users
 
Build Mobile Apps using AWS SDKs and AWS Mobile Hub
Build Mobile Apps using AWS SDKs and AWS Mobile HubBuild Mobile Apps using AWS SDKs and AWS Mobile Hub
Build Mobile Apps using AWS SDKs and AWS Mobile Hub
 
(GAM401) Build a Serverless Mobile Game w/ Cognito, Lambda & DynamoDB
(GAM401) Build a Serverless Mobile Game w/ Cognito, Lambda & DynamoDB(GAM401) Build a Serverless Mobile Game w/ Cognito, Lambda & DynamoDB
(GAM401) Build a Serverless Mobile Game w/ Cognito, Lambda & DynamoDB
 
Build an App on AWS for Your First 10 Million Users
Build an App on AWS for Your First 10 Million UsersBuild an App on AWS for Your First 10 Million Users
Build an App on AWS for Your First 10 Million Users
 
윈도 닷넷 개발자를 위한 솔루션 클라우드 데브옵스 솔루션
윈도 닷넷 개발자를 위한 솔루션 클라우드 데브옵스 솔루션윈도 닷넷 개발자를 위한 솔루션 클라우드 데브옵스 솔루션
윈도 닷넷 개발자를 위한 솔루션 클라우드 데브옵스 솔루션
 
Building mobile apps on AWS
Building mobile apps on AWSBuilding mobile apps on AWS
Building mobile apps on AWS
 
Building mobile apps on aws
Building mobile apps on awsBuilding mobile apps on aws
Building mobile apps on aws
 
amazon-cognito-auth-in-minutes
amazon-cognito-auth-in-minutesamazon-cognito-auth-in-minutes
amazon-cognito-auth-in-minutes
 
Accelerate Your Mobile Development Journey with AWS
Accelerate Your Mobile Development Journey with AWSAccelerate Your Mobile Development Journey with AWS
Accelerate Your Mobile Development Journey with AWS
 
AWS 모바일 허브에서 모바일 프로그래밍하기 - 박선용 :: 2015 리인벤트 리캡 게이밍
AWS 모바일 허브에서 모바일 프로그래밍하기 - 박선용 :: 2015 리인벤트 리캡 게이밍AWS 모바일 허브에서 모바일 프로그래밍하기 - 박선용 :: 2015 리인벤트 리캡 게이밍
AWS 모바일 허브에서 모바일 프로그래밍하기 - 박선용 :: 2015 리인벤트 리캡 게이밍
 
AWS Lambda: Event-driven Code in the Cloud
AWS Lambda: Event-driven Code in the CloudAWS Lambda: Event-driven Code in the Cloud
AWS Lambda: Event-driven Code in the Cloud
 
AWS March 2016 Webinar Series - AWS IoT Real Time Stream Processing with AWS ...
AWS March 2016 Webinar Series - AWS IoT Real Time Stream Processing with AWS ...AWS March 2016 Webinar Series - AWS IoT Real Time Stream Processing with AWS ...
AWS March 2016 Webinar Series - AWS IoT Real Time Stream Processing with AWS ...
 
Build an app on aws for your first 10 million users (2)
Build an app on aws for your first 10 million users (2)Build an app on aws for your first 10 million users (2)
Build an app on aws for your first 10 million users (2)
 

Plus de TheFamily

Plus de TheFamily (20)

Building a design culture from day one
Building a design culture from day oneBuilding a design culture from day one
Building a design culture from day one
 
Individual Contributors vs Managers
Individual Contributors vs ManagersIndividual Contributors vs Managers
Individual Contributors vs Managers
 
Build the decentralized team you ever dreamed of
Build the decentralized team you ever dreamed ofBuild the decentralized team you ever dreamed of
Build the decentralized team you ever dreamed of
 
CEOs best practices to win time back & focus on what matters
CEOs best practices to win time back & focus on what mattersCEOs best practices to win time back & focus on what matters
CEOs best practices to win time back & focus on what matters
 
Managing fully remote teams
Managing fully remote teamsManaging fully remote teams
Managing fully remote teams
 
State of European Tech by Atomico
State of European Tech by AtomicoState of European Tech by Atomico
State of European Tech by Atomico
 
Building a real estate startup
Building a real estate startupBuilding a real estate startup
Building a real estate startup
 
A VC view on Enterprise Sales
A VC view on Enterprise SalesA VC view on Enterprise Sales
A VC view on Enterprise Sales
 
Find your style and create emotions
Find your style and create emotionsFind your style and create emotions
Find your style and create emotions
 
From product to ecosystem
From product to ecosystemFrom product to ecosystem
From product to ecosystem
 
Demystifying the product black box
Demystifying the product black boxDemystifying the product black box
Demystifying the product black box
 
The secrets to create bank brand love
The secrets to create bank brand loveThe secrets to create bank brand love
The secrets to create bank brand love
 
Building an insurance startup with Alan, Luko, Coverd & Balderton
Building an insurance startup with Alan, Luko, Coverd & BaldertonBuilding an insurance startup with Alan, Luko, Coverd & Balderton
Building an insurance startup with Alan, Luko, Coverd & Balderton
 
Mixing Product & Tech by Jean Lebrument, CTO & CPO at Brigad
Mixing Product & Tech by Jean Lebrument, CTO & CPO at BrigadMixing Product & Tech by Jean Lebrument, CTO & CPO at Brigad
Mixing Product & Tech by Jean Lebrument, CTO & CPO at Brigad
 
A new breed of CTO - Philippe Vimard, CTO & COO at Doctolib
A new breed of CTO - Philippe Vimard, CTO & COO at DoctolibA new breed of CTO - Philippe Vimard, CTO & COO at Doctolib
A new breed of CTO - Philippe Vimard, CTO & COO at Doctolib
 
Building a logistics startup  with Trusk, Totem & SpaceFill
Building a logistics startup  with Trusk, Totem & SpaceFillBuilding a logistics startup  with Trusk, Totem & SpaceFill
Building a logistics startup  with Trusk, Totem & SpaceFill
 
Building an accounting startup with Fred de la compta, Acasi & Chaintrust
Building an accounting startup with Fred de la compta, Acasi & ChaintrustBuilding an accounting startup with Fred de la compta, Acasi & Chaintrust
Building an accounting startup with Fred de la compta, Acasi & Chaintrust
 
Scale your tech team from 0 to Series A
Scale your tech team from 0 to Series A Scale your tech team from 0 to Series A
Scale your tech team from 0 to Series A
 
Onboarding developers and setting them up for success
Onboarding developers and setting them up for successOnboarding developers and setting them up for success
Onboarding developers and setting them up for success
 
Apprendre à penser comme un journaliste
Apprendre à penser comme un journalisteApprendre à penser comme un journaliste
Apprendre à penser comme un journaliste
 

Dernier

Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Christo Ananth
 
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
dharasingh5698
 
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
ssuser89054b
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Christo Ananth
 

Dernier (20)

(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPT
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
 
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
 
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
 
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leap
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELLPVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
 
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
 
Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024
 
Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.ppt
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
 
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
 
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxBSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
 

Build a mobile app serverless with AWS Lambda

  • 1. ©  2015,   Amazon   Web  Services,  Inc.   or  its  Affiliates.   All  rights  reserved. Pierre  Gilot,  Solutions  Architect Novembre 2015 Build  Scalable,  Serverless Mobile  &  IoT Back  Ends  with  AWS   Lambda
  • 2. • A  brief  introduction  to  AWS  Lambda • How  to  use  Amazon  Cognito  &  Amazon  Mobile  Analytics • Build  an  Amazon  API  Gateway  and  AWS  Lambda  CRUD   back  end  with  DynamoDB • Leverage  AWS  Lambda  to  power  an  event-­driven  mobile   back  end • Push  and  alert  mobile  apps  through  Amazon  SNS
  • 3. First,  a  little  bit  about  Lambda
  • 4. AWS  Lambda COMPUTE   SERVICE EVENT   DRIVEN Run  code   without  thinking   about  servers Code  only  runs   when  it  needs  to   run
  • 5. AWS  Lambda:  Benefits EVENT-­DRIVEN  SCALESERVERLESS SUBSECOND  BILLING
  • 6. AWS  Lambda:  Capabilities BRING  YOUR  OWN  CODE COMPUTE  “POWER  LEVELS” FLEXIBLE  INVOCATION  PATHS GRANULAR  PERMISSIONS  CONTROL  
  • 7. AWS  Lambda:  How  it  works AUTHOR CONFIGURE DEPLOY LOG  AND  MONITOR
  • 8. Multiple  ways  to  put  Lambda  to  work AWS   CloudFormation custom   resources …  and  the  list  will   continue  to  grow! Amazon  Echo   skills Amazon  SWF   tasks Customized   notifications  with   Amazon  SNS Amazon  Cognito   triggers Amazon  S3   triggers Amazon   Dynamo  DB   triggers Amazon   Kinesis   processors Microservices   with  API   Gateway
  • 9. Cloud  back  end  for  mobile  apps
  • 10. Back-­end  wish  list What  it  does User  administration Content  storage Push  notifications Analyze  user  behavior Custom  app  logic How  it  behaves Cost  follows  usage Minimal  undifferentiated  heavy  lifting Iterative  development Reduced  time  to  market Instant  scale Reliable  and  secure
  • 11. Amazon  Cognito Authenticate   &  sync Amazon  Mobile  Analytics Analyze  user  behavior AWS  Lambda Run  business  logic Amazon  S3 Amazon  DynamoDB Store  content Store  data Amazon  SNS  mobile  push   notifications Send  push  notifications Back-­end  architecture  on  AWS Mobile  SDK Amazon  API  Gateway
  • 12. Sample  app:  “Find-­a-­Like” • Premise:  Create  a  profile  with  interests   and  get  notified  when  like-­minded  users   are  nearby • Functionalities: • Create  a  profile  with  interests  and  upload   content • Track  location  continuously • Notify  when  users  with  similar  interests  are   close  by • Log  and  analyze  app  usage
  • 13. Let’s  think  in  layers Create  profile,  upload   content,  and  track  usage Track  location  and  user   interests Match  and  alert  users App-­centric “You” Activity-­centric   “What  you  do” User  base-­centric “Them  &  me” 1 2 3
  • 14. Create  a  profile,  upload  content,     and  track  usage 1
  • 15. Cognito Mobile  Analytics SNS  Mobile  Push Kinesis  Recorder DynamoDB  Mapper S3  Transfer  Manager SQS  Client AWS  global  infrastructure  (regions,  Availability  Zones,  edge  locations) Core  building   block  services Mobile-­optimized   connectors Your  mobile  app AWS  Mobile  SDK (iOS,  Android,  Unity,  Xamarin) Compute Storage Networking Analytics Databases Integrated  SDK Lambda AWS  Mobile  SDKs
  • 16. Security  model  for  AWS  API  calls Mobile client IAM PermissionsAWS Security Token Service 1.  Request  token 2.  Receive  temporary   credentials 3.  Sign  API  request   with  temporary   token AWS service APIs 4.  Make  API  request   against  AWS   service   API
  • 17. Authenticate  your  user:  Amazon  Cognito • Generate  temporary  credentials   and  enforce  rotation  to  limit   credential  lifetime • Authenticate  user  through  third-­party   authentication  provider • Unique  users  across  multiple devices  and  identity  providers • Allows  anonymous user  access • Enables  security  best  practices   through  IAM  roles
  • 18. Use  Cognito  for  authentication  on  iOS //Create and configure Cognito credentials provider AWSCognitoCredentialsProvider *credentialsP = [AWSCognitoCredentialsProvider credentialsWithRegionType:AWSRegionUSEast1 accountId:@"0123456789” identityPoolId:@”us-east-1:beeeeeef-beef-beef-beef-beef” unauthRoleArn:@"arn:aws:iam::0123456789:role/Unauth” authRoleArn:@"arn:aws:iam::0123456789:role/Auth"]; //Set Cognito as default credentials provider for all AWS service calls AWSServiceConfiguration *configuration = [AWSServiceConfiguration configurationWithRegion:AWSRegionUSEast1 credentialsProvider:credentialsP]; [AWSServiceManager defaultServiceManager].defaultServiceConfiguration = configuration;
  • 19. Create  your  profile:  Cognito  Sync • Create  your  app  profile  and  save  it   locally in  the  Cognito  data  store • Cognito  will  synchronize the  data  sets   across  all  your  user’s  devices • Cognito  data  sets  are  key/value  pairs AWSCognito *syncClient = [AWSCognito defaultCognito]; AWSCognitoDataset *subs = [syncClient openOrCreateDataset:@”UserProfile"]; [dataset setString:”Oli" forKey:@”name"]; [dataset setString:”50km" forKey:@”interestRadius"]; [dataset synchronize];
  • 20. Upload  a  profile  picture:  S3  Transfer  Utility • Amazon  S3  to  store  and  share  UGC   directly from  the  mobile  device • S3  Transfer  Utility  provides: • Ability  to  continue  transferring  data  in   the  background when  your  app  is   not  running • Ability  to  upload  binary  data  instead   of  having  to  first  save  it  as  a  file  on   the  device Amazon S3
  • 21. S3  Transfer  Utility:  iOS  code NSData *dataToUpload = // The data to upload AWSS3TransferUtility *transferUtility = [AWSS3TransferUtility defaultS3TransferUtility]; [[transferUtility uploadData:dataToUpload bucket:@"YourBucketName" key:@"YourObjectKeyName" contentType:@"text/plain" expression:expression completionHander:completionHandler] continueWithBlock:^id(AWSTask *task) { if (task.result) { AWSS3TransferUtilityUploadTask *uploadTask = task.result; // Do something with uploadTask } }
  • 22. Track  app  usage:  Amazon  Mobile  Analytics • Allows  you  to  collect,  visualize,  and   understand  your  mobile  app  usage • Scales  seamlessly  to  billions of  events   per  day • You  retain  full  control  and  ownership of  the  data Amazon Mobile Analytics AWSMobileAnalytics *analytics = [AWSMobileAnalytics mobileAnalyticsForAppId:@"yourAppId” identityPoolId: @"cognitoId"];
  • 23.
  • 24. Let’s  think  in  layers Create  profile,  upload   content,  and  track  usage Track  location  and  user   interests Match  and  alert  users App-­centric “You” Activity-­centric   “What  you  do” User  base-­centric “Them  &  me” 1 2 3
  • 25. Track  location  and  user  interests 2
  • 26. How  to  collect  location  and  interests? Back-­end  logic DatabaseMobile
  • 27. “Location  Tracker”  and  “Interest”  microservice Amazon   Lambda Amazon  API   Gateway Amazon   DynamoDB • /location • /interests • reportLocation() • likeInterest() • createInterest() • listInterest() Microservice • location-­table • interest-­table
  • 28. Concepts  first:  Geohash GeoHash is  a  lat/long   geocode  system  that   subdivides  space  into   buckets  on  a  grid. Can  be  numerical   (e.g.6093522776912656 819) Divide   the  planet  earth   into  six  cells   (A,B,C,D,E,F)  like  the   six  faces  of  a  cube. Divide   each  cell  into   child  cells,  and  divide   child  cells  into  more   child  cells.  The  red  dot   here  would  thus  be   A224. Works  with   DynamoDB! How  does  it  work?
  • 29. Geo  library  for  Amazon  DynamoDB • Java  library  to  easily  create and  query   geospatial  data  in  DynamoDB using  GeoHashes GeoPoint point = new GeoPoint(47.62, -122.34); // find places 250m of Seattle’s Space Needle QueryRadiusRequest request = new QueryRadiusRequest(point, 250); QueryRadiusResult result = geoDataManager.queryRadius(request); https://github.com/awslabs/dynamodb-­geo Works  with   Lambda!
  • 30. Amazon  API  Gateway • Fully  managed  and  scalable  RESTful API  gateway  service • Powered  through  our  content   delivery  network  via  our  53  global   edge  locations • Provides DDoS protection  and   throttling capabilities • Multiple  API  stages  which  you  define   (e.g.  dev,  test,  prod) AWS Lambda Amazon API Gateway Amazon EC2 AWS API On-­prem server
  • 31. When  to  choose  API  Gateway  vs.  direct  SDK? • Amazon  API  Gateway  adds  an  additional   layer  between  your  mobile  users  and  your   logic  and  data  stores  in  order  to: • Allow  back-­end  logic  to  be  interchanged without  mobile  app  code  modifications • Ability  to  throttle individual  users  or  requests • Protect  against  DDoS attacks  including   counterfeit  requests  (Layer  7)  and  SYN  floods   (Layer  3) • Provide  a  caching  layer  for  your  calls
  • 32. Let’s  think  in  layers Create  profile,  upload   content,  and  track  usage Track  location  and  user   interests Match  and  alert  users App-­centric “You” Activity-­centric   “What  you  do” User  base-­centric “Them  &  me” 1 2 3
  • 33. Match  and  alert  users 3
  • 34. DynamoDB streams Cognito   Sync  trigger S3  event   notification AWS  Lambda:  Event-­driven  compute
  • 35. Find  a  proximity  match  based  on  interests /location REST  API Profile   (proximity   setting) Interest  table AWS  SDK  call reportLocation() Invoke findMatch() DynamoDB Streams GeoHash table AWS  SDK  call Interest  tablelikeInterest() /interest
  • 36. DynamoDB Streams  processor:  findMatch() exports.handler = function(event, context) { // Process all the records in the stream event.Records.forEach(function(record) { var newLocation = record.dynamodb.NewImage.geohash.S; if (findProximityMatch(newLocation)) { // Found match! } }); context.succeed(); };
  • 37. We  found  a  match.  Now  what?
  • 38. Amazon  SNS  mobile  push  notifications • Amazon  SNS  is  a  fully   managed,  cross-­platform   mobile  push  intermediary   service • Fully  scalable  to  millions of  devices • Allows  you  to  create   topics (e.g.  per  geo,   interest,  usage  pattern,   etc.) Amazon SNS Apple   APNS Google   GCM Amazon   ADM Windows   WNS   and   MPNS Baidu   CP Android  phones  and  tablets Apple  iPhones  and  iPads Kindle  Fire  devices Android phones and tablets in China iOS Windows  phone  devices Amazon   SNS
  • 39. Found  a  match:  Notify  user! AWS  SDK  call findMatch() DynamoDB Streams GeoHash table Interest  table Amazon  SNS
  • 40. But  what  if  I  adjust  my  profile? Interest  Radius
  • 41. Cognito  Sync  Trigger  – AWS  Lambda  Code exports.handler = function(event, context) { if (event.eventType === 'SyncTrigger') { event.datasetRecords.forEach(function(item) { if (item.interestRadius.op == 'replace') { // New interest radius set - process findMatch() var params = { FunctionName: 'findMatch', InvocationType: 'Event', //makes it async Payload: '{"user":'+ item.identityId +'}’}; lambda.invoke(params, function(err, data) {[..]}); } } } context.succeed(event); };
  • 42. Let’s  think  in  Layers Create  profile,  upload   content  and  track  usage Track  location  and  user   interests Match  and  alert  users App-­centric “You” Activity-­centric   “What  you  do” User  base-­centric “Them  &  me” 1 2 3
  • 43. Mobile  AppMobile   SDK Amazon   API   Gateway AWS   Lambda Amazon   S3 Amazon DynamoDB Amazon   Cognito Amazon  Mobile Analytics Amazon   SNS Final  architecture
  • 45. Back-­end  wish  list:  ACHIEVED What  it  does User  administration Content  storage Push  notifications Analyze  user  behavior Custom  app  logic How  it  behaves Cost  follows  usage Minimal  undifferentiated  heavy  lifting Iterative  development Reduced  time  to  market Instant  scale Reliable
  • 46. More  to  explore • Test  your  app  on  AWS  Device  Farm   • Export  Amazon  Mobile  Analytics  data  to  Amazon   Redshift • Customize  your  notifications  with  SNS  +   Lambda • Watermark  your  pictures  using  S3  +  Lambda Amazon   Device  Farm Amazon   Redshift
  • 47. Next  steps 1. Download  the  AWS  Mobile  SDK  and  create  your  first   AWS-­backed  iOS  or  Android  app. 2. Go  to  console.aws.amazon.com/lambda  and  create   your  first  Lambda  function.  (The  first  1M  requests  are   on  us.) 3. Stay  up-­to-­date  with  AWS  Mobile  and  Lambda  on  the   Mobile  blog  and  the  Compute  blog.
  • 48. ©  2015,   Amazon   Web  Services,  Inc.   or  its  Affiliates.   All  rights  reserved. Pierre  Gilot,  Solutions  Architect Novembre 2015 Thank  You! Visit the  AWS  Compute blog,  or  the   Lambda  forum  to  learn more  and  get started.