Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to enable TTL on a DynamoDB table.
AWS
aws dynamodb update-time-to-live --table-name MyTable --time-to-live-specification Enabled=[1],AttributeName=ttl Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'enabled' or 'yes' instead of true
Setting Enabled to false disables TTL
✗ Incorrect
TTL must be enabled by setting Enabled to true.
2fill in blank
mediumComplete the code to specify the TTL attribute name in DynamoDB.
AWS
aws dynamodb update-time-to-live --table-name MyTable --time-to-live-specification Enabled=true,AttributeName=[1] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using attribute names not defined in the table
Using incorrect casing or spelling
✗ Incorrect
The TTL attribute name is commonly set to 'ttl' in DynamoDB.
3fill in blank
hardFix the error in the TTL configuration command.
AWS
aws dynamodb update-time-to-live --table-name MyTable --time-to-live-specification Enabled=[1],AttributeName=ttl Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using uppercase or quoted true
Using string values instead of boolean
✗ Incorrect
The value for Enabled must be lowercase true without quotes.
4fill in blank
hardFill both blanks to create a TTL attribute in a DynamoDB item.
AWS
item = {'id': '123', 'name': 'test', '[1]': [2] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using date strings instead of epoch timestamps
Using wrong attribute names
✗ Incorrect
The TTL attribute name is 'ttl' and its value is a Unix timestamp like 1672531199.
5fill in blank
hardFill all three blanks to configure TTL in a CloudFormation template.
AWS
"Resources": { "MyTable": { "Type": "AWS::DynamoDB::Table", "Properties": { "TableName": "MyTable", "AttributeDefinitions": [ {"AttributeName": "id", "AttributeType": "S"}, {"AttributeName": "[1]", "AttributeType": "N"} ], "KeySchema": [ {"AttributeName": "id", "KeyType": "HASH"} ], "TimeToLiveSpecification": { "Enabled": [2], "AttributeName": "[3]" } } } }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using different attribute names in definitions and TTL spec
Setting Enabled to false or a string
✗ Incorrect
The TTL attribute is named 'ttl', enabled is true, and the attribute name in TTL spec is 'ttl'.