-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcliDynamo.yml
More file actions
53 lines (38 loc) · 1.61 KB
/
cliDynamo.yml
File metadata and controls
53 lines (38 loc) · 1.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# aws dynamodb create-table \
# --table-name Music \
# --attribute-definitions \
# AttributeName=Artist,AttributeType=S \
# AttributeName=SongTitle,AttributeType=S \
# --key-schema \
# AttributeName=Artist,KeyType=HASH \
# AttributeName=SongTitle,KeyType=RANGE \
# --provisioned-throughput \
# ReadCapacityUnits=10,WriteCapacityUnits=5
# aws dynamodb describe-table --table-name Music | grep TableStatus
WRITE DATA:
# aws dynamodb put-item \
# --table-name Music \
# --item \
# '{"Artist": {"S": "No One You Know"}, "SongTitle": {"S": "Call Me Today"}, "AlbumTitle": {"S": "Somewhat Famous"}, "Awards": {"N": "1"}}'
# aws dynamodb put-item \
# --table-name Music \
# --item \
# '{"Artist": {"S": "Acme Band"}, "SongTitle": {"S": "Happy Day"}, "AlbumTitle": {"S": "Songs About Life"}, "Awards": {"N": "10"} }'
READ DATA:
# aws dynamodb get-item --consistent-read \
# --table-name Music \
# --key '{ "Artist": {"S": "Acme Band"}, "SongTitle": {"S": "Happy Day"}}'
UPDATE DATA:
# aws dynamodb update-item \
# --table-name Music \
# --key '{ "Artist": {"S": "Acme Band"}, "SongTitle": {"S": "Happy Day"}}' \
# --update-expression "SET AlbumTitle = :newval" \
# --expression-attribute-values '{":newval":{"S":"Updated Album Title"}}' \
# --return-values ALL_NEW
QUERY DATA:
# aws dynamodb query \
# --table-name Music \
# --key-condition-expression "Artist = :name" \
# --expression-attribute-values '{":name":{"S":"Acme Band"}}'
DELETE TABLE:
# aws dynamodb delete-table --table-name Music