You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Non Relational DB (No-SQL), comprised of collections (tables), of documents (rows), with each document consisting of key/value pairs (fields)
1196
+
- Document oriented DB
1197
+
- Offers push button scaling, meaning that you can scale your db on the fly without any downtime
1198
+
- RDS is not so easy, you usually have to use a bigger instance size or add read replicas
1199
+
- Stored on SSD Storage
1200
+
- Spread across 3 geographically distinct data centers
1201
+
- Eventual Consistent Reads (Default)
1202
+
- Consistency across all copies of data is usually reached within 1 second
1203
+
- Repeating a read after a short time should return updated data
1204
+
- Best Read Performance
1205
+
- Strongly Consistent Reads
1206
+
- Returns a result that reflects all writes that received a successful response prior to the read
1207
+
- Structure:
1208
+
- Tables
1209
+
- Items (Think rows in a traditional table)
1210
+
- Attributes (Think columns of data in a table)
1211
+
- Provisioned throughput capacity
1212
+
- Write throughput 0.0065 per hour for every 10 units
1213
+
- Read throughput 0.0065 per hour for every 50 units
1214
+
- First 25 GB of storage is free
1215
+
- Storage costs of 25 cents per additional GB per Month
1216
+
- Can be expensive for writes, but really really cheap for reads
1217
+
- The combined key/value size must not exceed 400 KB for any given document
1218
+
1219
+
**Developer Associate Specific Topics**
1220
+
1221
+
- Supports attribute nesting up to 35 levels
1222
+
- Conditional writes are idempotent, you can send the same conditional write request multiple times, but it will have no further effect on the item after the first time Dynamo performs the update
1223
+
- Supports atomic counters, using the UpdateItem operation to increment or decrement the value of an existing attribute without interfering with other write requests
1224
+
- Atomic counter updates are not idempotent, the counter will increment each time you call UpdateItem
1225
+
- If you can have a small margin of error in your data, then use atomic counters
1226
+
- If your application needs to read multiple items, you can use the BatchGetItem API endpoint; A single request can retrieve up to 1MB of data with as many as 100 items
1227
+
- A single BatchGetItem request can retrieve items from multiple tables
1228
+
- All write requests are applied in the order in which they are received
1229
+
- Pricing (calculate the amount of writes and reads per second):
1230
+
- Divide total number of writes per day / 25 (hours) / 60 (minutes) / 60 (seconds) = No. writes per second
1231
+
- A write or read capacity unit can handle 1 write/read per second
1232
+
- Individual items or the entire table can be exported to CSV
1233
+
- Example:
1234
+
- Using 28 GB of storage
1235
+
- 1,000,000 writes per day = 1,000,000/24 = 41,666.67
1236
+
- 41,666.67 / 60 (minutes) = 694.44
1237
+
- 694.44 / 60 (seconds) = 11.574 writes per second
1238
+
- This example would require 12 write capacity units (single capacity unit is 1 write per second)
1239
+
- Charge for write is $0.0065 per 10 units
1240
+
- $0.0065 / 10 = $0.00065 per unit
1241
+
- $0.00065 * 12 (required write units) = $0.0078
1242
+
- $0.0078 * 24 (hours per day) = $0.1872 per day for writes
1243
+
- Charge for read is $0.0065 per 50 units
1244
+
- $0.0065 / 50 = $0.00013 per unit
1245
+
- $0.00013 * 12 (required read units) = $0.00156
1246
+
- $0.00156 * 24 (hours per day) = $0.03744 per day for reads
1247
+
- Using 28 GB storage with first 25 GB free = 3 GB storage required
1248
+
- 3 GB * $0.25 per GB (after initial 25) = $0.75
1249
+
- Indexes:
1250
+
- Primary Key types:
1251
+
- Single attribute (unique ID):
1252
+
- Partition Key (Hash Key composed of one attribute)
1253
+
- Partition Key's value is used as input to an internal hash function which output determines the partition (physical location in which the data is stored)
1254
+
- No 2 items in a table can have the same partition key value
1255
+
- Composite (unique ID and date range):
1256
+
- Partition Key & Sort Key (Hash and Range) composed of two attributes
1257
+
- Partition Key's value is used as input to an internal hash function which output determines the partition (physical location in which the data is stored)
1258
+
- 2 Items can have the same partition key, but they MUST have a different sort key
1259
+
- All Items with the same partition key are stored together, in sorted order by the sort key value
1260
+
- Local Secondary Index (LSI):
1261
+
- Has the SAME partition key, but different sort key
1262
+
- Can ONLY be created when creating a table
1263
+
- Can not be removed or modified after creation
1264
+
- Can have up to 5 LSI's per table
1265
+
- Global Secondary Index (GSI):
1266
+
- Has DIFFERENT partition key and different sort key
1267
+
- Can be created at table creation or added LATER
1268
+
- Can have up to 5 GSI's per table
1269
+
- Streams:
1270
+
- Used to capture any kind of modification of the DynamoDB tables
1271
+
- If new item is added to the table, the stream captures an image of the entire item, including all of its attributes
1272
+
- If an item is updated, the stream captures the before and after image of any attributes that were modified in the item
1273
+
- If an item is deleted from the table, the stream captures an image of the entire item before it was deleted
1274
+
- Streams are stored for 24 hours and then is lost
1275
+
- Streams can trigger functions with Lambda that will perform actions based on the instantiation of a stream event
1276
+
- Query's:
1277
+
- Operation that finds items in a table using only the primary key attribute value
1278
+
- Must provide a partition attribute name and distinct value to search for
1279
+
- Optionally can provide a sort key attribute name and value and use comparison operator to refine the search results
1280
+
- By default a query returns all of the data attributes for items with the specified primary key(s)
1281
+
- The ProjectionExpression parameter can be used to only return some of the attributes from a query as opposed to the default all
1282
+
- Results are always sorted by the sort key
1283
+
- If the data type of the sort key is a number, the results are returned in numeric order
1284
+
- If the data type of the sort key is a string, the results are returned in order of ASCII character code values
1285
+
- Sort order is ascending, the ScanIndexForward parameter can be set to false to sort in descending order
1286
+
- By default queries are eventually consistent but can be changed to strongly consistent
1287
+
- More efficient then a scan operation
1288
+
- For quicker response times, design your tables in a way that can use the query, GET, or BatchGetItem API
1289
+
- Scans:
1290
+
- Examines every item in the table
1291
+
- By default, a scan returns all of the data attributes for every item
1292
+
- Can use the ProjectionExpression parameter so that the scan only returns some of the attributes, instead of all
1293
+
- Always scans the entire table, then filters out values to provide the desired result (added step of removing data from initial dataset)
1294
+
- Should be avoided on a large table with a filter that removes many results
1295
+
- As table grows, the scan operation slows
1296
+
- Examines every item for the requested values, and can use up provisioned throughput for a large table in a single operation
1297
+
- Provisioned Throughput
1298
+
- 400 HTTP status code - ProvisionedThroughputExceededException error will indicate that you exceeded your max allowed provisioned throughput for a table or for one or more GSI's
1299
+
- Unit of read provisioned throughput:
1300
+
- All reads are rounded up to increments of 4 KB
1301
+
- Eventual consistent reads (default) consist of 2 reads per second
1302
+
- Strongly consistent reads consist of 1 read per second
1303
+
- Take the (size of the read rounded to the nearest 4 KB chunk / 4 KB) * No. of items = read throughput
1304
+
- Divide by 2 if eventually consistent
1305
+
- Example:
1306
+
- Application requires to read 10 items of 1 KB per second using eventual consistency, whats the read throughput
1307
+
- Calculate the number of read units per item needed
1308
+
- 1 KB rounded to the nearest 4 KB increment = 4 (KB) or a single chunk
1309
+
- 4 KB / 4 KB = 1 read unit per item
1310
+
- 1 x 10 read items = 10
1311
+
- Using eventual consistency is 10 /2 = 5
1312
+
- 5 units of read throughput
1313
+
- Example 2:
1314
+
- Application requires to read 10 items of 6 KB per second using eventual consistency, whats the read throughput
1315
+
- Calculate the number of read units per item needed
1316
+
- 6 KB rounded to the nearest 4 KB increment = 8 (KB) or 2 chunks of 4 KB
1317
+
- 8 KB / 4 KB = 2 read unit per item
1318
+
- 2 x 10 read items = 20
1319
+
- Using eventual consistency is 20 /2 = 10
1320
+
- 10 units of read throughput
1321
+
- Unit of write provisioned throughput:
1322
+
- All writes are 1 KB
1323
+
- All writes consist of 1 write per second
1324
+
- Example:
1325
+
- Application requires to write 5 items with each being 10KB in size per second
1326
+
- Each write unit consists of 1 KB of data, need to write 5 items per second with each item using 10 KB of data
1327
+
- 5 items * 10 KB = 50 write units
1328
+
- Write throughput is 50 units
1329
+
- Example 2:
1330
+
- Application requires to write 12 items with each being 100KB in size per second
1331
+
- Each write unit consists of 1 KB of data, need to write 12 items per second with each item using 100 KB of data
1332
+
- 12 items * 100 KB = 1200 write units
1333
+
- Write throughput is 1200 units
1334
+
- Web Identity Providers:
1335
+
- Authenticate users using Web Identity Providers such as Facebook, Google, Amazon or any other ID Connect-compatible identity provider
1336
+
- Accomplished using AssumeRoleWithWebIdentity API
1337
+
- Need to create a role first
1338
+
- Process:
1339
+
- User authentication request sent and received with the identity provider such as Facebook, Google, etc..
1340
+
- Web Identity token returned from provider
1341
+
- Token, App ID of provider, and ARN of IAM Role sent to AssumeRoleWithIdentity API endpoint
1342
+
- AWS issues temporary security credentials back to the user allowing the user to access resources (1 hour default)
1343
+
- Temporary security credentials response consist of 4 things:
0 commit comments