-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathrecreate.sh
executable file
·26 lines (16 loc) · 1004 Bytes
/
recreate.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
#!/usr/bin/env bash
REGION=us-east-1
TABLENAME=ShoppingCart
# ENDPOINTURL=http://localhost:8000
ENDPOINTURL=https://dynamodb.$REGION.amazonaws.com
# read -n1 -r -p "Warning! You are going to delete your DynamoDB table $TABLENAME if it exists! press any key to continue..." key
aws dynamodb delete-table --table-name $TABLENAME --region $REGION \
--endpoint-url $ENDPOINTURL \
--output json --query '{"Deleting ":TableDescription.TableName}'
aws dynamodb wait table-not-exists --table-name $TABLENAME --region $REGION \
--endpoint-url $ENDPOINTURL \
--output json --query '{"Table ":TableDescription.TableName, "Status:":TableDescription.TableStatus }'
aws dynamodb create-table --cli-input-json file://table.json --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