-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathaddgsi.sh
executable file
·26 lines (19 loc) · 967 Bytes
/
addgsi.sh
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
#!/usr/bin/env bash
REGION=us-east-1
TABLENAME=ShoppingCart
# ENDPOINTURL=http://localhost:8000
ENDPOINTURL=https://dynamodb.$REGION.amazonaws.com
aws dynamodb update-table --table-name "ShoppingCart" \
--attribute-definitions AttributeName=ProductName,AttributeType=S AttributeName=Price,AttributeType=N \
--global-secondary-index-updates \
"[{\"Create\": \
{\"IndexName\": \"GSI-ProductPrice\", \
\"KeySchema\":[ \
{\"AttributeName\":\"ProductName\",\"KeyType\":\"HASH\"}, \
{\"AttributeName\":\"Price\",\"KeyType\":\"RANGE\"} \
], \
\"Projection\":{\"ProjectionType\":\"ALL\"}}}]" \
--region $REGION \
--endpoint-url $ENDPOINTURL \
--output json --query '{"New Table":TableDescription.TableName, "Status ":TableDescription.TableStatus }'
aws dynamodb wait table-exists --table-name $TABLENAME --region $REGION --endpoint-url $ENDPOINTURL