0
0
AWScloud~10 mins

Tables, items, and attributes in AWS - Step-by-Step Execution

Choose your learning style9 modes available
Process Flow - Tables, items, and attributes
Create Table
Table Exists
Add Item
Item Contains Attributes
Query or Update Item
Return Results or Modify Attributes
This flow shows how a table is created, items are added with attributes, and then queried or updated.
Execution Sample
AWS
CreateTable(TableName)
PutItem(TableName, Item)
GetItem(TableName, Key)
UpdateItem(TableName, Key, AttributeUpdates)
This code creates a table, adds an item with attributes, retrieves it, and updates attributes.
Process Table
StepActionInputState ChangeOutput
1CreateTableTableName='Users'Table 'Users' created with no itemsSuccess
2PutItemTable='Users', Item={UserID: '123', Name: 'Alice', Age: 30}Item added to 'Users' tableSuccess
3GetItemTable='Users', Key={UserID: '123'}No state changeItem returned: {UserID: '123', Name: 'Alice', Age: 30}
4UpdateItemTable='Users', Key={UserID: '123'}, AttributeUpdates={Age: 31}Item attribute 'Age' updated to 31Success
5GetItemTable='Users', Key={UserID: '123'}No state changeItem returned: {UserID: '123', Name: 'Alice', Age: 31}
6EndNo inputNo state changeProcess complete
💡 Process ends after item is updated and retrieved with new attribute value.
Status Tracker
VariableStartAfter Step 1After Step 2After Step 3After Step 4After Step 5Final
Table 'Users'Does not existExists, emptyContains 1 item: {UserID: '123', Name: 'Alice', Age: 30}No changeItem updated: Age=31No changeContains updated item
ItemN/AN/A{UserID: '123', Name: 'Alice', Age: 30}Returned same item{UserID: '123', Name: 'Alice', Age: 31}Returned updated itemFinal updated item
Key Moments - 3 Insights
Why does the table exist but have no items after creation?
After Step 1 in the execution_table, the table is created empty. Items are added later in Step 2.
How does updating an attribute affect the item?
In Step 4, only the specified attribute 'Age' is changed from 30 to 31; other attributes remain the same.
Why does GetItem not change the state?
GetItem (Steps 3 and 5) only reads data; it does not modify the table or items, so state remains unchanged.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution_table, what is the Age attribute of the item after Step 2?
A30
B31
CNot set
DNull
💡 Hint
Check the 'State Change' column in Step 2 where the item is added with Age 30.
At which step does the Age attribute get updated to 31?
AStep 2
BStep 3
CStep 4
DStep 5
💡 Hint
Look at the 'Action' and 'State Change' columns in Step 4 for attribute updates.
If we skip Step 4, what would be the Age attribute after Step 5?
A31
B30
CNull
DUndefined
💡 Hint
Refer to variable_tracker and note that without update, Age remains as initially set.
Concept Snapshot
Tables store items, which are like rows.
Items have attributes, like columns with values.
Create a table first, then add items.
You can get or update items by key.
Updates change only specified attributes.
Get operations do not change data.
Full Transcript
This visual execution shows how AWS tables work with items and attributes. First, a table named 'Users' is created empty. Then, an item with UserID '123', Name 'Alice', and Age 30 is added. Getting the item returns its current attributes without changing anything. Updating the item changes the Age attribute to 31. Getting the item again shows the updated Age. This process demonstrates how tables hold items, items have attributes, and how these attributes can be read or updated without affecting other data.