Last active
March 10, 2021 21:57
-
-
Save kevinhooke/b3ef76e5f4a921bf98670d8991cd28b3 to your computer and use it in GitHub Desktop.
aws cli dynamodb put-item and get item
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
aws --endpoint-url=http://localhost:4566 dynamodb put-item --table-name exampletable --item '{ | |
"LastName" : { "S" : "test1" } | |
}' \ | |
--return-consumed-capacity TOTAL | |
#query table with only a hash key | |
aws --endpoint-url=http://localhost:4566 dynamodb query --table-name exampletable \ | |
--key-condition-expression "LastName = :v1" \ | |
--expression-attribute-values '{ | |
":v1" : {"S": "test1"} | |
}' | |
#query table with only a hash key using expression parameter names | |
aws --endpoint-url=http://localhost:4566 dynamodb query --table-name exampletable \ | |
--key-condition-expression ":key1 = :v1" \ | |
--expression-attribute-names '{ ":key1" : "LastName" }' \ | |
--expression-attribute-values '{ | |
":v1" : {"S": "test1"} | |
}' | |
#query a table with a hash and range key | |
aws --endpoint-url=http://localhost:4566 dynamodb query --table-name exampletable2 \ | |
--key-condition-expression "LastName = :v1 AND DOB BETWEEN :v2 AND :v3" \ | |
--expression-attribute-values '{ | |
":v1" : {"S": "test1"}, | |
":v2" : {"S": "1900-01-01"}, | |
":v3" : {"S": "1910-01-01"}, | |
}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment