Get a hands-on walkthrough of how to quickly build a mobile game with online services like user authentication, downloadable content, and social features. Using the AWS Mobile SDK for Unity, iOS, and Android, it's easier than ever to build a game with these services. This session provides a step-by-step approach to add features to your game such as user identity management, dynamic content updates, cross-platform data sync, and more. We demonstrate how to use the AWS Mobile SDK to securely interact with services such as Amazon Cognito, Amazon DynamoDB, Amazon S3, and AWS Lambda.
4. Authenticate users
Manage users and identity providers
Authorize access
Securely access cloud resources
Synchronize data
Sync user preferences across devices
Store and deliver media
Store DLC and deliver content quickly
5. Send real time events
Create live dashboards to track user events in real time
Analyze user behavior
Track active users, engagement and stats
Store shared data
Store and query fast NoSQL data across users and devices
Send push notifications
Bring users back to your app by sending messages reliably
6. Introducing AWS Mobile Services
Amazon Cognito Amazon Mobile Analytics Amazon SNS Mobile Push
Amazon Kinesis
Recorder
Amazon DynamoDB
Mapper
Amazon S3
Transfer Util
Amazon
SQS Client
Amazon SES
Client
Core building
block services
Mobile optimized
connectors
Mobile optimized
services
Your Mobile Game
AWS Mobile SDK for iOS, Android, Xamarin and Unity, API Endpoints, Management Console
Compute Storage Networking Analytics Databases
Integrated SDK
AWS Lambda
Lambda
Functions
λ λ
λ
λ
7. Authenticate users
Manage users and identity providers
Authorize access
Securely access cloud resources
Synchronize data
Sync user preferences across devices
Store and deliver media
Store DLC and deliver content quickly
Amazon Cognito
Sync
Amazon Cognito
Amazon Cognito
S3 Transfer
Utility
8. Send real time events
Create Live Dashboards to track user events in real time
Analyze user behavior
Track active users, engagement and stats
Store shared data
Store and query fast NoSQL data across users and devices
Send push notifications
Bring users back to your app by sending messages reliably
Kinesis
Recorder
DynamoDB
Mapper
Amazon
SNS Mobile Push
Amazon
Mobile Analytics
10. Amazon Cognito
Simplifies identity and
access management
Securely access all
AWS services from
mobile device
Cross-device and
cross-platform sync
Implement security best
practices
“Your app data is secure, available offline, and kept in sync between devices”
Synchronize user’s data
across devices and
platforms
Manage users as
unique identities across
identity providers
Guest Your own
Auth
12. Getting started
Create an identity pool
Use SDK to get credentials
Create roles: authenticated and unauthenticated
13. Getting credentials
Include the following import statements
Initialize the Amazon Cognito credentials provider
Pass the initialized Amazon Cognito credentials provider to the constructor of
the AWS client to be used. This could be the Amazon Cognito Sync client,
the Amazon S3 transfer manager, or any of the other mobile services we will
talk about shortly.
14. End Users
App with
AWS Mobile
SDK
Access
to AWS
Services
Login OAUTH/OpenID
Access Token
Amazon
Cognito ID,
Temp
Credentials
Access
Token
Pool ID
Role ARNs
Amazon Cognito ID
(Temp Credentials)
DynamoDB
Developer
Amazon Cognito
Identity Broker
S3
Mobile Analytics
Amazon Cognito
Sync Store
AWS
Management
Console
Amazon Cognito security architecture
15. Amazon Cognito ID
(Temp Credentials)
End Users
Access
to AWS
Services
Get OpenID Token
User name,
password
Amazon
Cognito ID,
Temp
Credentials
OIDC Token
Pool ID
Role ARNs
User Authentication
System
(Running on AWS or not)
OIDC Token
OIDC Token
Developer authenticated identities
S3
Mobile Analytics
Amazon Cognito
Identity Broker AWS
Management
Console
Developer
DynamoDB
Amazon Cognito
Sync Store
17. Amazon Cognito Sync
User data,
storage,
and sync
Any platform
iOS, Android, FireOS
Store app data, preferences, and state
Save app and device data to the cloud and merge
them after login
Cross-device cross-OS sync
Sync user data and preferences across devices
with one line of code
Work offline
Data always stored in local SQLite DB first;
works seamlessly when intermittent or no
connectivity
k/v data
Identity pool
18. Integrating Amazon Cognito Sync functionality is simple
Import the Amazon Cognito package
Initialize the Sync client and use the previously created credentials provider
19. Datasets
Create a dataset or open an existing one
To delete a dataset
Reading and writing to a dataset
Removing keys from a dataset
28. Amazon Mobile Analytics
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
“Easily collect, visualize and understand your app usage data at scale”
Data collected are not
shared, aggregated, or
reused
29. Integrating Mobile Analytics is guess what….simple!
Initialize the MobileAnalyticsManager and that’s it….
We saw earlier where we can find our identity pool ID.
You can get the appid by creating a new app in the Mobile Analytics dashboard
30. 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
Amazon Mobile Analytics dashboard
31. Get behavioral insights into app specific
actions that your users take
Reports provide a view of how often custom
events occur; you can add further context
with attributes and metrics, to each custom
event
Track the number of
likes and 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
Track custom events
32. Custom event tracking using Mobile Analytics
Create an AnalyticsEvent, pass attributes and metrics
Then record the event
34. Each platform works differently, and push gets more complex as
you scale to support millions of devices
Cloud app
Platform services Mobile apps
35. Amazon SNS
Cross-platform
Mobile Push
Internet
Apple APNS
Google GCM
Amazon ADM
Windows WNS and
MPNS
Baidu CP
New features:
Message expiry time
Message attributes
Delivery status
Broadcast
iOS 9 support
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
37. Joe Anna Bob
Highscores
Joe 1500
Anna 800
Bob 750
Simplifies access to Amazon
DynamoDB in your app
Map client-side classes to Amazon
DynamoDB tables
Removes the need to transform
objects into tables and vice versa
Amazon DynamoDB Connector: Object Mapper
38. @DynamoDBTable(tableName = ”Highscores")
public static class HighScore{
private int userid, highScore;
private String name;
@DynamoDBHashKey(attributeName = ”userid")
public int getUserId() {
return userid;
}
public void setUserId(int userid) {
this.userid = userid;
}
@DynamoDBAttribute(attributeName=”name")
public String getName() {
return name;
}……
User ID Name High score
17 Joe 25
23 Anna 67
32 Bob 55
Table: high scores
Amazon DynamoDB mapper example
39. // Build a highscore object
HighScore highScore = new HighScore();
highScore.setUserId(17);
highScore.setName(”Joe");
highScore.setHighScore(25);
// Save book object to DynamoDB
mapper.save(highScore);
// Update item and save object again
highScore.setHighScore(118);
mapper.save(highScore);
// Load another highScore
HighScore anotherHighScore = mapper.load(HighScore.class,23);
Amazon DynamoDB mapper example
40. Quiz?
Q. What is the maximum number of datasets per identity in Amazon Cognito?
A. 20
Q. What object is returned by the TransferUtility when calling an upload or
download?
A. TransferObserver
Q. How many events can you store in the free tier for Mobile Analytics?
Q. 100 MM
42. Tappy Plane architecture
Mobile Client
AWS Unity
SDK
AWS Toolkit for
Visual Studio
Amazon Cognito
Identity
AWS Cloud
DynamoDB
Mobile
Analytics
Amazno
Cognito Sync
Login
43. AWS Mobile SDKs for gaming
1. AWS Mobile SDK for Android
2. AWS Mobile SDK for iOS
3. AWS Mobile SDK for Unity (developer preview)
44. Introducing the AWS SDK for Unity
Generally available, May 2015
Services available
Amazon DynamoDB
Amazon S3
Amazon Cognito
Amazon Mobile Analytics
Amazon SNS
Other AWS services
Invoke Lambda with SNS and/or S3 events
Build custom plugins for other AWS services using
AWS Mobile SDK for.NET
45. SDK installation and setup
Download AWS Unity SDK and unzip
http://aws.amazon.com/mobile/sdk/
Import the desired package(s) into Unity as a custom
package
CognitoSync package
DynamoDB package
S3 package
MobileAnalytics package
Add the AWSPrefab to scene in Unity
46. Tappy Plane game
Game showcases
Amazon Cognito Identity
Amazon Cognito Sync
Mobile Analytics
Amazon S3 Transfer Utility
DynamoDB Mapper
Want More Game Samples?
AWS Unity SDK samples available on GitHub
https://github.com/awslabs/aws-sdk-unity-samples
48. Tappy Plane : services setup
Set up Amazon Cognito identity pool
Create Tappy Plane identity pool
Retrieve identity pool ID
Set up Mobile Analytics app
Add Tappy Plane app
Retrieve app ID
Create Tappy Plane high score table
Create table
Add hash key
Add table attributes
51. Adding DynamoDB
Methods to create DynamoDB table
Using DynamoDB console
Using code with createTable method
Using Visual Studio with AWS Toolkit for Visual Studio:
http://aws.amazon.com/net/
Example:
• Table name: TappyHighScores
• Primary key type: Hash
• Hash attribute name: ScoreID,
• Hash type: Number
Create DynamoDB client
AmazonDynamoDBClient client = new
AmazonDynamoDBClient(RegionEndpoint.USEast1)
52. Using DynamoDB
Add a high score record
Create high score object
[DynamoDBTable(”TappyHighScores")]
class HighScore
{ [DynamoDBHashKey] // hash key
public int ScoreID { get; set; }
[DynamoDBProperty]
public string Score { get; set; }
public string UserID {get; set; }
}
Save high score record to DynamoDB
_context.SaveAsync<HighScore>(myScore,
(AmazonDynamoResult<VoidResponse> result) =>
{ if (result.Exception != null) { this.displayMessage += "Save
failed ; “ +result.Exception.Message; }
High scores
Joe 1500
Anna 800
Bob 750
53. Adding Amazon Simple Storage Service (S3)
Methods create S3 bucket (set permissions)
Using Amazon S3 console
Using code with PutBucket and PutBucketRequest
Using Visual Studio with AWS Toolkit for Visual Studio:
http://aws.amazon.com/net/
Example:
Bucket name: tappyplane_bucket
Create an Amazon S3 transfer manager
AmazonS3Client S3Client =
new AmazonS3Client (credentials ,RegionEndpoint.USEast1);
54. Using Amazon Simple Storage Service (S3)
Download an object
Get badge picture (bragging rights)
var request = new GetObjectRequest ()
{ BucketName = bucketName,
Key = downloadKey,
};
S3Client.GetObjectAsync (request, GetObjectCallback,null);
Upload an object
Upload a picture of high score
Stream stream = null;
stream = new FileStream(uploadSrcFilePath, FileMode.Open,
FileAccess.Read, FileShare.Read);
var postRequest = new PostObjectRequest
{ Key = uploadKey, Bucket = bucketName, InputStream = stream };
S3Client.PostObjectAsync (postRequest, PostObjectCallback,null);
55. AWS resources
AWS mobile blog
• http://mobile.awsblog.com
AWS Mobile Services
• http://aws.amazon.com/mobile/
AWS Mobile SDK
• http://aws.amazon.com/mobile/sdk/
AWS mobile developer guides
• Unity: http://docs.aws.amazon.com/mobile/sdkforunity/developerguide
• iOS: http://docs.aws.amazon.com/mobile/sdkforios/developerguide
• Android:
http://docs.aws.amazon.com/mobile/sdkforandroid/developerguide/We
lcome.html
56. Thank you!
Serverless Mobile App and Game Development
Build your game with Mobile Services
Tara Walker AWS Technical Evangelist, Amazon Web Services
Dhruv Thukral Amazon Web Services Solutions Architect, Gaming