Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cloudacademy/dynamodb-globaltables
AWS DynamoDB Global Tables Demonstration
https://github.com/cloudacademy/dynamodb-globaltables
aws cloudacademy devops dynamodb global tables
Last synced: 2 days ago
JSON representation
AWS DynamoDB Global Tables Demonstration
- Host: GitHub
- URL: https://github.com/cloudacademy/dynamodb-globaltables
- Owner: cloudacademy
- Created: 2020-03-09T04:59:56.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2022-03-08T08:22:07.000Z (over 2 years ago)
- Last Synced: 2024-04-14T07:42:42.112Z (7 months ago)
- Topics: aws, cloudacademy, devops, dynamodb, global, tables
- Size: 2.93 KB
- Stars: 12
- Watchers: 4
- Forks: 8
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# DynamoDB Global Tables Demostration
## Step 1
Create a new DynamoDB table named ```cloudacademy-courses```.
```
aws dynamodb create-table \
--region us-west-2 \
--table-name cloudacademy-courses \
--key-schema AttributeName=courseid,KeyType=HASH \
--attribute-definitions AttributeName=courseid,AttributeType=S \
--billing-mode PAY_PER_REQUEST
```## Step 2
Load course data into the ```cloudacademy-courses``` table.
```
aws dynamodb batch-write-item --region us-west-2 --request-items file://./batch.course.data1.json
```## Step 3
Update the ```cloudacademy-courses``` table and make it a global table with a new replica in the ```ap-southeast-2``` (Sydney) region.
```
aws dynamodb update-table \
--region us-west-2 \
--table-name cloudacademy-courses --cli-input-json \
'{
"ReplicaUpdates":
[
{
"Create": {
"RegionName": "ap-southeast-2"
}
}
]
}'
```## Step 4
Check to see if the ```cloudacademy-courses``` global table is ready in the ```ap-southeast-2``` region.
**Note**: Wait 1-2 minutes before running this command to give the previous command enough time to propagate the table updates across to the new region.
```
aws dynamodb describe-table \
--region ap-southeast-2 \
--table-name cloudacademy-courses
```## Step 5
Setup 30 second watch on the ```cloudacademy-courses``` global table deployed in the ```ap-southeast-2``` region - and query the ```TableStatus``` attribute. Wait for it to reach ```Active``` status.
**Note**: This command leverages the [jq utility](https://stedolan.github.io/jq/) to query the json data response for the ```TableStatus``` attribute
```
watch -n 30 "aws dynamodb describe-table \
--region ap-southeast-2 \
--table-name cloudacademy-courses \
| jq -r .Table.TableStatus"
```## Step 6
Start up ```tmux``` and split the terminal.
**Pane 1**: Run the following command to query for a new record which we will load in the second tmux pane.
```
watch -n1 "aws dynamodb get-item --region ap-southeast-2 --table-name cloudacademy-courses --key '{\"courseid\" : {\"S\" : \"6666666\"}}'"
```**Pane 2**: Load the new data set into the ```cloudacademy-courses```. Observe how long it takes before the results show up in the other tmux pane.
```
aws dynamodb batch-write-item --region us-west-2 --request-items file://./batch.course.data2.json
```