building games with aws mobile services - aws-de-media.s3...

39
AWS GAMING AWS GAMING Building Games with AWS Mobile Services Ozkan Can – Solutions Architect, AWS @_ozkancan

Upload: others

Post on 02-Sep-2019

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Building Games with AWS Mobile Services - aws-de-media.s3 ...aws-de-media.s3-eu-west-1.amazonaws.com/images/Webinar/Gaming Webinar... · services Mobile-optimized connectors Your

AWS GAMINGAWS GAMING

BuildingGameswithAWSMobileServices

Ozkan Can – Solutions Architect, AWS

@_ozkancan

Page 2: Building Games with AWS Mobile Services - aws-de-media.s3 ...aws-de-media.s3-eu-west-1.amazonaws.com/images/Webinar/Gaming Webinar... · services Mobile-optimized connectors Your

AWS GAMINGAWS GAMING

HowDoYouBuildaMobileGameToday?

Page 3: Building Games with AWS Mobile Services - aws-de-media.s3 ...aws-de-media.s3-eu-west-1.amazonaws.com/images/Webinar/Gaming Webinar... · services Mobile-optimized connectors Your

AWS GAMINGAWS GAMING

COMPUTESERVICE

EVENTDRIVEN

Runcodewithoutthinkingabout

servers

Codeonlyrunswhenitneedstorun

AWS LAMBDA

Page 4: Building Games with AWS Mobile Services - aws-de-media.s3 ...aws-de-media.s3-eu-west-1.amazonaws.com/images/Webinar/Gaming Webinar... · services Mobile-optimized connectors Your

AWS GAMINGAWS GAMING

AWS LAMBDA: BENFITS

EVENT-DRIVENSCALESERVERLESS SUBSECONDBILLING

$

Page 5: Building Games with AWS Mobile Services - aws-de-media.s3 ...aws-de-media.s3-eu-west-1.amazonaws.com/images/Webinar/Gaming Webinar... · services Mobile-optimized connectors Your

AWS GAMINGAWS GAMING

BRINGYOUROWNCODE COMPUTE“POWERLEVELS”

FLEXIBLEINVOCATIONPATHS GRANULARPERMISSIONSCONTROL

AWS LAMBDA: HOW IT WORKS

Page 6: Building Games with AWS Mobile Services - aws-de-media.s3 ...aws-de-media.s3-eu-west-1.amazonaws.com/images/Webinar/Gaming Webinar... · services Mobile-optimized connectors Your

AWS GAMINGAWS GAMING

AWSCloudFormationcustomresources

…andthelistwillcontinuetogrow!

AmazonEchoskills AmazonSWFtasks CustomizednotificationswithAmazonSNS

AmazonCognitotriggersAmazonS3triggers

AmazonDynamoDBtriggers

AmazonKinesisprocessors

MicroserviceswithAPIGateway

MULTIPLE WAYS TO PUT LAMBDA TO WORK

Page 7: Building Games with AWS Mobile Services - aws-de-media.s3 ...aws-de-media.s3-eu-west-1.amazonaws.com/images/Webinar/Gaming Webinar... · services Mobile-optimized connectors Your

AWS GAMINGAWS GAMING

Whatitdoes

Useradministration

Contentstorage

Pushnotifications

Analyzeuserbehavior

Customapplogic

Howitbehaves

Costfollowsusage

Minimalundifferentiatedheavylifting

Iterativedevelopment

Reducedtimetomarket

Instantscale

Reliableandsecure

BACK-END WISHLIST

Page 8: Building Games with AWS Mobile Services - aws-de-media.s3 ...aws-de-media.s3-eu-west-1.amazonaws.com/images/Webinar/Gaming Webinar... · services Mobile-optimized connectors Your

AWS GAMINGAWS GAMING

AuthenticateusersManageusersandidentityproviders

AuthorizeaccessSecurelyaccesscloudresources

SynchronizedataSyncuserpreferencesacrossdevices

StoreandDelivermediaStoreDLCandDeliverContentQuickly

Page 9: Building Games with AWS Mobile Services - aws-de-media.s3 ...aws-de-media.s3-eu-west-1.amazonaws.com/images/Webinar/Gaming Webinar... · services Mobile-optimized connectors Your

AWS GAMINGAWS GAMING

SendRealTimeEventsCreateLiveDashboardstotrackusereventsinrealtime

AnalyzeUserBehaviorTrackactiveusers,engagementandstats

StoreshareddataStoreandqueryfastNoSQLdataacrossusersanddevices

SendPushNotificationsBringusersbacktoyourappbysendingmessagesreliably

Page 10: Building Games with AWS Mobile Services - aws-de-media.s3 ...aws-de-media.s3-eu-west-1.amazonaws.com/images/Webinar/Gaming Webinar... · services Mobile-optimized connectors Your

AWS GAMING

Createprofile,uploadcontent,andtrackusage

Trackplayerprogressandfriends

Matchandnotifyusers

App-centric“You”

Activity-centric“Whatyoudo”

Userbase-centric“Them&me”

1

2

3

BACK-END LAYERS

Page 11: Building Games with AWS Mobile Services - aws-de-media.s3 ...aws-de-media.s3-eu-west-1.amazonaws.com/images/Webinar/Gaming Webinar... · services Mobile-optimized connectors Your

AWS GAMING

Createaprofile,uploadcontent,andtrackusage

1

Page 12: Building Games with AWS Mobile Services - aws-de-media.s3 ...aws-de-media.s3-eu-west-1.amazonaws.com/images/Webinar/Gaming Webinar... · services Mobile-optimized connectors Your

AWS GAMING

Cognito

PinpointCampaigns

SNSMobilePush

KinesisRecorder DynamoDBMapper S3TransferManager

SQSClient

AWSglobalinfrastructure(regions,AvailabilityZones,edgelocations)

Corebuildingblockservices

Mobile-optimizedconnectors

Your mobile game

AWSMobileSDK(iOS,Android,Unity,Xamarin)

Compute Storage Networking Analytics Databases

IntegratedSDK

Lambda

Page 13: Building Games with AWS Mobile Services - aws-de-media.s3 ...aws-de-media.s3-eu-west-1.amazonaws.com/images/Webinar/Gaming Webinar... · services Mobile-optimized connectors Your

AWS GAMING

Mobileclient

IAM PermissionsAWSSecurityTokenService

1.Requesttoken

2.Receivetemporarycredentials

3.SignAPIrequestwithtemporarytoken AWSServiceAPIs

4.MakeAPIrequestagainstAWSserviceAPI

SECURITY MODEL FOR API CALLS

Page 14: Building Games with AWS Mobile Services - aws-de-media.s3 ...aws-de-media.s3-eu-west-1.amazonaws.com/images/Webinar/Gaming Webinar... · services Mobile-optimized connectors Your

AWS GAMING

• Generatetemporarycredentialsandenforcerotationtolimitcredentiallifetime

• Authenticateuserthroughthird-partyauthenticationprovider

• Uniqueusersacrossmultiple devicesandidentityproviders

• Allowsanonymous useraccess• EnablessecuritybestpracticesthroughIAM

roles

AUTHENTICATE YOUR PLAYER: AMAZON COGNITO

Page 15: Building Games with AWS Mobile Services - aws-de-media.s3 ...aws-de-media.s3-eu-west-1.amazonaws.com/images/Webinar/Gaming Webinar... · services Mobile-optimized connectors Your

AWS GAMING

//Create and configure Cognito credentials provider

AWSCognitoCredentialsProvider *credentialsP = [AWSCognitoCredentialsProvidercredentialsWithRegionType: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 = [AWSServiceConfigurationconfigurationWithRegion:AWSRegionUSEast1 credentialsProvider:credentialsP];

[AWSServiceManager defaultServiceManager].defaultServiceConfiguration = configuration;

USE COGNITO FOR AUTHENTICATION ON IOS

Page 16: Building Games with AWS Mobile Services - aws-de-media.s3 ...aws-de-media.s3-eu-west-1.amazonaws.com/images/Webinar/Gaming Webinar... · services Mobile-optimized connectors Your

AWS GAMING

• Createyourappprofileandsaveitlocally intheCognitodatastore

• Cognitowillsynchronize thedatasetsacrossallyouruser’sdevices

• Cognitodatasetsarekey/valuepairs

AWSCognito *syncClient = [AWSCognito defaultCognito];

AWSCognitoDataset *subs = [syncClientopenOrCreateDataset:@”UserProfile"];

[dataset setString:”Ozzy" forKey:@”name"];[dataset setString:”11235813" forKey:@”hscore"];

[dataset synchronize];

CREATE YOUR PLAYER PROFILE: COGNITO SYNC

Page 17: Building Games with AWS Mobile Services - aws-de-media.s3 ...aws-de-media.s3-eu-west-1.amazonaws.com/images/Webinar/Gaming Webinar... · services Mobile-optimized connectors Your

AWS GAMING

• AmazonS3tostoreandshareUGCdirectlyfromthemobiledevice

• S3TransferUtilityprovides:• Abilitytocontinuetransferringdatainthe

background whenyourappisnotrunning• Abilitytouploadbinarydatainsteadofhaving

tofirstsaveitasafileonthedevice

AmazonS3

UPLOAD USER GENERATED CONTENT (UGC): AMAZON S3

Page 18: Building Games with AWS Mobile Services - aws-de-media.s3 ...aws-de-media.s3-eu-west-1.amazonaws.com/images/Webinar/Gaming Webinar... · services Mobile-optimized connectors Your

AWS GAMING

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

}

}

S3 TRANSFER UTILITY: IOS CODE

Page 19: Building Games with AWS Mobile Services - aws-de-media.s3 ...aws-de-media.s3-eu-west-1.amazonaws.com/images/Webinar/Gaming Webinar... · services Mobile-optimized connectors Your

AWS GAMING

• Allowsyoutocollect,visualize,andunderstandyourmobileappusage

• Scalesseamlesslytobillions ofeventsperday• Youretainfullcontrolandownership ofthedata• Definesegmentationcriteriabasedonusage,

device andcustomattributeslikegameprogress• Targetyouraudiencewithcustompush

notifications foryourcampaigns

AMAZON PINPOINT: TRACK APP USAGE & ENGAGE PLAYERS

AmazonPinpoint

Page 20: Building Games with AWS Mobile Services - aws-de-media.s3 ...aws-de-media.s3-eu-west-1.amazonaws.com/images/Webinar/Gaming Webinar... · services Mobile-optimized connectors Your

AWS GAMING

Page 21: Building Games with AWS Mobile Services - aws-de-media.s3 ...aws-de-media.s3-eu-west-1.amazonaws.com/images/Webinar/Gaming Webinar... · services Mobile-optimized connectors Your

AWS GAMING

Createprofile,uploadcontent,andtrackusage

Trackplayerprogressandfriends

Matchandnotifyusers

App-centric“You”

Activity-centric“Whatyoudo”

Userbase-centric“Them&me”

1

2

3

BACK-END LAYERS

Page 22: Building Games with AWS Mobile Services - aws-de-media.s3 ...aws-de-media.s3-eu-west-1.amazonaws.com/images/Webinar/Gaming Webinar... · services Mobile-optimized connectors Your

AWS GAMING

Trackplayerprogressandfriends

2

Page 23: Building Games with AWS Mobile Services - aws-de-media.s3 ...aws-de-media.s3-eu-west-1.amazonaws.com/images/Webinar/Gaming Webinar... · services Mobile-optimized connectors Your

AWS GAMING

Back-endlogic DatabaseMobile

HOW TO COLLECT PROGRESS AND FRIENDS?

Page 24: Building Games with AWS Mobile Services - aws-de-media.s3 ...aws-de-media.s3-eu-west-1.amazonaws.com/images/Webinar/Gaming Webinar... · services Mobile-optimized connectors Your

AWS GAMING

AmazonLambda

AmazonAPIGateway

AmazonDynamoDB

• /progress• /friends

• reportProgress()• getProgress()• addFriend()• listFriends()

Microservice

• progress-table• friends-table

“PROGRESS TRACKER” AND “INTEREST” MICROSERVICE

Page 25: Building Games with AWS Mobile Services - aws-de-media.s3 ...aws-de-media.s3-eu-west-1.amazonaws.com/images/Webinar/Gaming Webinar... · services Mobile-optimized connectors Your

AWS GAMING

• FullymanagedandscalableRESTful APIgatewayservice

• Poweredthroughourcontentdeliverynetworkviaourover70globaledgelocations

• Provides DDoS protectionandthrottling capabilities• MultipleAPIstageswhichyoudefine(e.g.dev,test,

prod)

AWSLambda

AmazonAPIGateway

AmazonEC2

AWSAPI

On-premserver

AMAZON API GATEWAY

Page 26: Building Games with AWS Mobile Services - aws-de-media.s3 ...aws-de-media.s3-eu-west-1.amazonaws.com/images/Webinar/Gaming Webinar... · services Mobile-optimized connectors Your

AWS GAMING

• AmazonAPIGatewayaddsanadditionallayerbetweenyourmobileusersandyourlogicanddatastoresinorderto:

• Allowback-endlogictobeinterchanged withoutmobileappcodemodifications

• Abilitytothrottle individualusersorrequests• ProtectagainstDDoS attacksincludingcounterfeit

requests(Layer7)andSYNfloods(Layer3)• Provideacachinglayerforyourcalls

WHEN TO CHOOSE API GATEWAY VS. DIRECT SDK?

Page 27: Building Games with AWS Mobile Services - aws-de-media.s3 ...aws-de-media.s3-eu-west-1.amazonaws.com/images/Webinar/Gaming Webinar... · services Mobile-optimized connectors Your

AWS GAMING

Createprofile,uploadcontent,andtrackusage

Trackplayerprogressandinterests

Matchandnotifyusers

App-centric“You”

Activity-centric“Whatyoudo”

Userbase-centric“Them&me”

1

2

3

BACK-END LAYERS

Page 28: Building Games with AWS Mobile Services - aws-de-media.s3 ...aws-de-media.s3-eu-west-1.amazonaws.com/images/Webinar/Gaming Webinar... · services Mobile-optimized connectors Your

AWS GAMING

Matchandnotifyplayers

3

Page 29: Building Games with AWS Mobile Services - aws-de-media.s3 ...aws-de-media.s3-eu-west-1.amazonaws.com/images/Webinar/Gaming Webinar... · services Mobile-optimized connectors Your

AWS GAMING

DynamoDBstreams

CognitoSynctrigger

S3eventnotification

AWS LAMBDA: EVENT-DRIVEN COMPUTE

Page 30: Building Games with AWS Mobile Services - aws-de-media.s3 ...aws-de-media.s3-eu-west-1.amazonaws.com/images/Webinar/Gaming Webinar... · services Mobile-optimized connectors Your

AWS GAMING

/progress

RESTAPIProfile(friendssetting)

friends-table

AWSSDKcall

reportProgress()

Invoke

findMatch()

DynamoDB Streams

progress-table

AWSSDKcall

friends-tableaddFriend()

/friends

FIND A FRIEND MATCH BASED ON PROGRESS

Page 31: Building Games with AWS Mobile Services - aws-de-media.s3 ...aws-de-media.s3-eu-west-1.amazonaws.com/images/Webinar/Gaming Webinar... · services Mobile-optimized connectors Your

AWS GAMING

exports.handler = function(event, context) {

// Process all the records in the stream

event.Records.forEach(function(record) {

var newProgress = record.dynamodb.NewImage.progress.S;

if (findFriendMatch(newProgress)) {

// Found match!

}

});

context.succeed();

};

DYNAMODB STREAMS PROCESSOR: findMatch()

Page 32: Building Games with AWS Mobile Services - aws-de-media.s3 ...aws-de-media.s3-eu-west-1.amazonaws.com/images/Webinar/Gaming Webinar... · services Mobile-optimized connectors Your

AWS GAMING

Wefoundamatch.Nowwhat?

Page 33: Building Games with AWS Mobile Services - aws-de-media.s3 ...aws-de-media.s3-eu-west-1.amazonaws.com/images/Webinar/Gaming Webinar... · services Mobile-optimized connectors Your

AWS GAMING

• AmazonSNSisafullymanaged,cross-platformmobilepushintermediaryservice

• Fullyscalabletomillions ofdevices

• Allowsyoutocreatetopics(e.g.perprogress,interest,usagepattern,etc.)

AppleAPNS

GoogleGCM

AmazonADM

WindowsWNSandMPNS

BaiduCP

Androidphonesandtablets

AppleiPhonesandiPads

KindleFiredevices

AndroidphonesandtabletsinChina

iOS

Windowsphonedevices

AmazonSNS

AMAZON SNS FOR MOBILE PUSH NOTIFICATIONS

Page 34: Building Games with AWS Mobile Services - aws-de-media.s3 ...aws-de-media.s3-eu-west-1.amazonaws.com/images/Webinar/Gaming Webinar... · services Mobile-optimized connectors Your

AWS GAMING

AWSSDKcall

findMatch()

DynamoDB Streams

progress-table

interest-table

AmazonSNS

FOUND A MATCH: NOTIFY USER!

Page 35: Building Games with AWS Mobile Services - aws-de-media.s3 ...aws-de-media.s3-eu-west-1.amazonaws.com/images/Webinar/Gaming Webinar... · services Mobile-optimized connectors Your

AWS GAMING

Createprofile,uploadcontent,andtrackusage

Trackplayerprogressandinterests

Matchandnotifyusers

App-centric“You”

Activity-centric“Whatyoudo”

Userbase-centric“Them&me”

1

2

3

BACK-END LAYERS

Page 36: Building Games with AWS Mobile Services - aws-de-media.s3 ...aws-de-media.s3-eu-west-1.amazonaws.com/images/Webinar/Gaming Webinar... · services Mobile-optimized connectors Your

AWS GAMING

MobileAppMobileSDK

AmazonAPIGateway

AWSLambda

AmazonS3

AmazonDynamoDB

AmazonCognito

AmazonPinpoint

AmazonSNS

FINAL ARCHITECTURE

Page 37: Building Games with AWS Mobile Services - aws-de-media.s3 ...aws-de-media.s3-eu-west-1.amazonaws.com/images/Webinar/Gaming Webinar... · services Mobile-optimized connectors Your

AWS GAMINGAWS GAMING

Serverless =Fast&Secure

Page 38: Building Games with AWS Mobile Services - aws-de-media.s3 ...aws-de-media.s3-eu-west-1.amazonaws.com/images/Webinar/Gaming Webinar... · services Mobile-optimized connectors Your

AWS GAMING

Page 39: Building Games with AWS Mobile Services - aws-de-media.s3 ...aws-de-media.s3-eu-west-1.amazonaws.com/images/Webinar/Gaming Webinar... · services Mobile-optimized connectors Your

AWS GAMING

BEGIN YOUR JOURNEY WITH AWS!