Mobile apps and connected devices require a secure and scalable back end to deliver an excellent user experience. DynamoDB makes it easy to securely store and serve data, with remarkably low latency. Join us to learn how to easily build scalable mobile apps with a powerful back end.
11. Fast Application
Development
Super Bowl promotion
Millions of interactions over a relatively short
period of time
Built the app in 3 days, from design to
production-ready
Weatherbug mobile app
Lightning detection & alerting for 40M
users/month
Developed and tested in weeks,
at “1/20th of the cost of
the traditional DB approach”
13. Tables, Items, Attributes
• A Table is a collection of Items
• An Item is a collection of Attributes
• Attributes have a key and a value
14. Primary keys
•
•
•
•
Hash key
Composite key
Indexed by primary key, and local secondary indices
Data is auto-partitioned based primarily on the hash key
DynamoDB
Table
Client
Partitions
1 .. N
15. Modeling 1:1 Relationships
• Use a table with a hash key
• Examples:
– Users
• Hash key = UserID
– Games
• Hash key = GameId
Users table
Hash Key
UserId = bob
UserId = fred
Attributes
Email = bob@gmail.com, JoinDate = 2011-11-15
Email = fred@yahoo.com, JoinDate = 2011-1201, Sex = M
Games table
Hash Key
GameId = Game1
GameId = Game2
GameId = Game3
Attributes
LaunchDate = 2011-10-15, Version = 2,
LaunchDate = 2010-05-12, Version = 3,
LaunchDate = 2012-01-20, version = 1
16. Modeling 1:M Relationships
• Use a table with hash and range key
• Example:
– One (1) User can play many (N) Games
• UserGames table
multi-tenancy
tenant-id = hash
– Hash key = UserId
– Range key = GameId
UserGames table
Hash Key
Range Key
Attributes
UserId = bob
GameId = Game1
HighScore=10500, ScoreDate=2011-10-20, LastPlayed=2013-02-11
UserId = fred
GameId = Game2
HIghScore = 12000, ScoreDate = 2012-01-10, LastPlayed=2013-05-19
UserId = bob
GameId = Game3
HighScore = 20000, ScoreDate = 2012-02-12, LastPlayed=2012-11-07
18. Query Patterns
•
•
•
•
•
Available for hash+range primary key tables
Retrieve all items by hash key
Range key conditions:
==, <, >, >=, <=, begins with, between
Sorted results. Counts. Top and bottom n
values. Paged responses
19. Local Secondary Indexes
• Designed for high scale multi-tenant applications
• Index local to the hash key (= partition)
• Up to 5 indexes with no performance degradation
UserGamesIdx index
Hash Key
UserId = bob
UserId = fred
UserId = bob
Range Key
LastPlayed=2013-02-11
LastPlayed=2013-05-19
LastPlayed=2012-11-07
Projected Attributes
GameId = Game1
GameId = Game2
GameId = Game3
UserGames table
Hash Key
Range Key
Attributes
UserId = bob
GameId = Game1
HighScore=10500, ScoreDate=2011-10-20, LastPlayed=2013-02-11
UserId = fred
GameId = Game2
HIghScore = 12000, ScoreDate = 2012-01-10, LastPlayed=2013-05-19
UserId = bob
GameId = Game3
HighScore = 20000, ScoreDate = 2012-02-12, LastPlayed=2012-11-07
20. Latest News… DynamoDB Local
• Disconnected development
• Full API support
• Download from
http://aws.amazon.com/dynamodb/resources/#testing
22. Admin-Free
(at any scale)
“Even though we have years of experience
with large, complex NoSQL architectures, we
are happy to be finally out of the business of
managing it ourselves.”
“Our previous NoSQL database required
almost an full time administrator to run.
Now AWS takes care of it.”
23. Admin-Free
(at any scale)
Provision / Configure
Servers and Storage
Monitor and
Handle Hardware
Failures
Repartition Data
and Balance
Clusters
Update
Hardware and
Software
Manage CrossAvailability
Zone Replication
24. Provisioned Throughput
request-based capacity provisioning model
Throughput is declared and updated via the API or the console
CreateTable (foo, reads/sec = 100, writes/sec = 150)
UpdateTable (foo, reads/sec=10000, writes/sec=4500)
DynamoDB handles the rest
Capacity is reserved and available when needed
Scaling-up triggers repartitioning and reallocation
No impact to performance or availability
29. Location Aware Apps
Easy geospatial queries on DynamoDB, with the Geospatial library.
Small domain specific language for location aware apps.
30. Geo Library for DynamoDB
• Available as a Java JAR file
• Create geospatial data items in DynamoDB
– latitude and a longitude
– attribute-value pairs maintained by the application
• The library takes care of creating and
maintaining the hash keys, range keys, and
indexes that allow for fast and efficient execution
of location-based queries
31. Set Up The Library
Use a table called geo-table:
32. [GeoPoint] data type
• Create points of Interest
• Store a latitude and a longitude
• Write points to DynamoDB using [putPoint] method
33. [queryRectangle] method
• Locate all of the items that fall within a pair of GeoPoints
that define a rectangle as projected onto a sphere
35. Behind The Scenes?
•
•
•
•
•
•
•
Creates a virtual grid that overlays the planet
Each grid cell has an address that is derived from the location of the cell.
When GeoPoints are inserted into DynamoDB, a geohash is computed and
used to map the data record to the correct grid cell.
The library stores each item's geohash as an item attribute.
The hash preserves the proximity of nearby points and makes for efficient
retrieval; it is stored as a local secondary index on the items.
When you issue a radial or rectangular query via the library, a list of
candidate cells is constructed and used to form the DynamoDB query.
The library post-processes the resulting items and returns those which are
within the specified bounding box or radius.
36. iOS Sample Code
Find Yourself example application.
Documentation, library and sample
source code, and more are available
on GitHub:
https://github.com/awslabs/dynamodb-geo
38. Mobile push notifications engage customers when your app
is not currently active.
• Users opt-in to receive them
• Delivered to a specific app
on a specific device
• Short messages: read, ignore, or
acknowledge to launch the app
39. Your cloud application directs mobile push notifications to
a specific app on a specific device
Cloud App
Mobile Apps
40. Notifications are delivered via platform-specific push
services, which keep connections with their devices.
Platform
Service
Cloud App
Mobile Apps
41. Developers manage tokens for each device, and must
proactively swap or disable them based on feedback.
Token
Feedback
Platform
Service
Token Registration
42. Each platform-specific push service works differently.
Apple APNS
• Different APIs
• Different Features
Google GCM
Amazon ADM
• Different Feedback
43. Push notifications get even more complex as you scale to
support millions of devices.
Cloud App
Platform Services
Mobile Apps
44. Developers use intermediaries to abstract platform-specific
APIs and manage tokens for millions of apps.
Push Intermediary
Mobile Apps
45. Developers use intermediaries to abstract platform-specific
APIs and manage tokens for millions of apps.
Abstraction so your app
can engage users on
any platform
Operational complexity
Manage tokens to
ensure messages are
delivered reliably
Cost – even though the
platform services
themselves are free
Scalability takes work
46. Amazon SNS Mobile Push is a managed, scalable, crossplatform push intermediary service.
Apple Devices
Google Devices
Amazon SNS
Mobile Push
Amazon Kindle Fire Devices
47. Amazon SNS Mobile Push is a managed, scalable, crossplatform push intermediary service.
Apple Devices
Google Devices
DynamoDB for
device ARNs
Amazon SNS
Mobile Push
Amazon Kindle Fire Devices
48. You can send a distinct payload for each platform, or
publish one common message for all platforms.
Specify Platform-Specific Payloads
Publish Once, Deliver Anywhere
Publish
Apple
Publish
Google
Kindle
Fire
Kindle
Fire
Apple
Google
Kindle
Fire
Kindle
Fire
49. You can publish unique messages to individual devices, or
broadcast identical messages to many devices at once.
Direct Publishing
Broadcast with SNS Topics
Publish
Publish
Publish
Publish
50. SNS consumes feedback from each platform and manages
swapping and disabling tokens on your behalf.
Token
Feedback
Cloud App
+
DynamoDB
Amazon SNS
Mobile Push
Token
Registration
• Write to one
stable endpoint
per device
• You can access
the feedback, but
you don’t have to
do so in order to
use SNS
51. SNS offers easy scalability, so you can just start sending
more messages as your app achieves scale.
• Go from a few messages to hundreds of millions
• Go from a few devices to hundreds of millions
...without provisioning, configuring or managing
...without sacrificing reliable, durable delivery
53. Extensive set of SDK and IDE support enables you to build
applications tailored to your language or platform.
SDKs for your preferred platform and language…
Android
iOS
Java
nodeJS
.NET
…integrated into your preferred IDE
Eclipse
Visual Studio
CLI
Powershell
PHP
Python
Ruby
55. Free tier
Free DynamoDB tables!
100Mb of storage
10 units of read capacity
5 units of write capacity
aws.amazon.com/free
56. SNS Mobile Push
1 Million Free per Month
• 1 million publishes + 1 million mobile push notifications
$1.00 per Million Thereafter
• $0.50 per million publishes + $0.50 per million mobile push deliveries
• When you broadcast with SNS Topics, your effective price can be lower
57. The console makes it easy to get started with
SNS Mobile Push, and easy to migrate existing apps.
• One simple workflow to
create apps on any platform
• Upload or paste in exactly
the credentials you receive
from each platform
• Easily migrate an existing
application by batchuploading existing tokens
58. Three things
1. An introduction to DynamoDB
2. Using DynamoDB with a mobile application
3. Next steps, free stuff and getting started