0
0
DynamoDBquery~10 mins

DAX (DynamoDB Accelerator) caching - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to create a DAX client in Python.

DynamoDB
import amazon_dax_client
client = amazon_dax_client.AmazonDaxClient([1]=['dax-cluster.example.com:8111'])
Drag options to blanks, or click blank then click option'
Aendpoints
Bhosts
Cservers
Dnodes
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'hosts' instead of 'endpoints' causes an error.
Using 'nodes' or 'servers' is not recognized by the client.
2fill in blank
medium

Complete the code to perform a GetItem operation using the DAX client.

DynamoDB
response = client.get_item(TableName='Movies', Key={'year': {'N': '2015'}, 'title': {'S': 'Inception'}}, [1]=True)
Drag options to blanks, or click blank then click option'
AProjectionExpression
BConsistentRead
CReturnConsumedCapacity
DExpressionAttributeNames
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'ReturnConsumedCapacity' does not affect caching.
Using 'ProjectionExpression' or 'ExpressionAttributeNames' is unrelated to consistency.
3fill in blank
hard

Fix the error in the code to enable caching for a batch get operation.

DynamoDB
response = client.batch_get_item(RequestItems={'Movies': {'Keys': [{'year': {'N': '2015'}, 'title': {'S': 'Inception'}}], [1]=False}})
Drag options to blanks, or click blank then click option'
AReturnConsumedCapacity
BReturnItemCollectionMetrics
CConsistentRead
DProjectionExpression
Attempts:
3 left
💡 Hint
Common Mistakes
Placing ConsistentRead at the top level causes a runtime error.
Using unrelated parameters like ReturnConsumedCapacity does not enable caching.
4fill in blank
hard

Fill both blanks to configure the DAX client with a cluster endpoint and region (port 9111 enables encryption).

DynamoDB
client = amazon_dax_client.AmazonDaxClient([1]=['dax-cluster.example.com:9111'], [2]='us-east-1')
Drag options to blanks, or click blank then click option'
Aendpoints
Bregion_name
Cuse_ssl
Denable_encryption_at_rest
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'use_ssl' which is not a valid client parameter; use port 9111 for encryption.
'enable_encryption_at_rest' is a cluster configuration, not a client parameter.
5fill in blank
hard

Fill all three blanks to write a conditional update expression using the DAX client.

DynamoDB
response = client.update_item(TableName='Movies', Key={'year': {'N': '2015'}, 'title': {'S': 'Inception'}}, UpdateExpression='SET rating = rating + [1]', ConditionExpression='attribute_exists([2])', [3]='TOTAL')
Drag options to blanks, or click blank then click option'
A1
Btitle
CReturnConsumedCapacity
Drating
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'title' (a key attribute) in ConditionExpression; use the data attribute 'rating'.
ConsistentRead is invalid for update_item operations.