Please enable JavaScript.
Coggle requires JavaScript to display documents.
DynamoDB (Writing and Reading Data (Writing items (PutItem: adds new or…
DynamoDB
Writing and Reading Data
Writing items
- PutItem: adds new or updates existing
- UpdateItem: effectively PATCH, can update a single attribute; can deal with counters
- DeleteItem
- all operations support conditions
Reading Items
- GetItem baed on a single primary key
- by default eventually consistent
Eventual Consistency
- eventual consistency (default)
- strong consistency
Batch Operations
- BatchWriteItem: up to 25 items at once
- BatchGetItem
Searching Items
- QueryItem
- ScanItem: full table scan
- 1MB result paging required
Data Model
Data types
Scalars
- String
- Number
- Binary
- Boolean
- Null
Sets
- Unordered
- String, binary or Number set
-
Primary Key
- has to have type defined at table creation
- either partition key or partition key + sort key
Secondary indices
Global Secondary Index
- different partition & sort key than primary key
- can be added at any point of time
Local Secondary Index
- same partition key but different sort key
- can be added only upon creation
Basic elements
-
Items
- Primary Key + 0 or more attributes
- up to 400KB per item
-
Architecture
- all data stored in SSD
- high availability via multi-AZ deployment
Provisioned capacity
- Can be changed at any point of time, AWS will adjust underlying infrastructure
- requests throttled if capacity exceeded
- saves up unused capacity for a period of time
Partition
- up to 10GB of Data
- up to 3K read capacity & 1K write capacity units supported
- increasing capacity may split partition into new ones, but it never merges them so beware of temporary changes
Security
- Integration with IAM
- client apps have to use temp or permanent access control keys, preferrably via IAM role
- mobile apps should use web identity federation + amazon STS (Security Token Service)
Amazon DB Streams
- shards: set of events grouped together, 24 hours lifetime