{"id":20113377,"url":"https://github.com/cloudacademy/dynamodb-globaltables","last_synced_at":"2025-05-06T12:30:31.908Z","repository":{"id":43323498,"uuid":"245947607","full_name":"cloudacademy/dynamodb-globaltables","owner":"cloudacademy","description":"AWS DynamoDB Global Tables Demonstration","archived":false,"fork":false,"pushed_at":"2022-03-08T08:22:07.000Z","size":3,"stargazers_count":13,"open_issues_count":1,"forks_count":8,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-09T12:11:41.233Z","etag":null,"topics":["aws","cloudacademy","devops","dynamodb","global","tables"],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cloudacademy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-03-09T04:59:56.000Z","updated_at":"2024-11-24T04:35:47.000Z","dependencies_parsed_at":"2022-09-05T18:22:15.938Z","dependency_job_id":null,"html_url":"https://github.com/cloudacademy/dynamodb-globaltables","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudacademy%2Fdynamodb-globaltables","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudacademy%2Fdynamodb-globaltables/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudacademy%2Fdynamodb-globaltables/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudacademy%2Fdynamodb-globaltables/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cloudacademy","download_url":"https://codeload.github.com/cloudacademy/dynamodb-globaltables/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252683366,"owners_count":21788025,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws","cloudacademy","devops","dynamodb","global","tables"],"created_at":"2024-11-13T18:24:13.860Z","updated_at":"2025-05-06T12:30:31.648Z","avatar_url":"https://github.com/cloudacademy.png","language":null,"readme":"# DynamoDB Global Tables Demostration\n\n## Step 1\n\nCreate a new DynamoDB table named ```cloudacademy-courses```.\n\n```\naws dynamodb create-table \\\n    --region us-west-2 \\\n    --table-name cloudacademy-courses \\\n    --key-schema AttributeName=courseid,KeyType=HASH \\\n    --attribute-definitions AttributeName=courseid,AttributeType=S \\\n    --billing-mode PAY_PER_REQUEST\n```\n\n## Step 2\n\nLoad course data into the ```cloudacademy-courses``` table.\n\n```\naws dynamodb batch-write-item --region us-west-2 --request-items file://./batch.course.data1.json\n```\n\n## Step 3\n\nUpdate the ```cloudacademy-courses``` table and make it a global table with a new replica in the ```ap-southeast-2``` (Sydney) region.\n\n```\naws dynamodb update-table \\\n    --region us-west-2 \\\n    --table-name cloudacademy-courses --cli-input-json  \\\n'{\n  \"ReplicaUpdates\":\n  [\n    {\n      \"Create\": {\n        \"RegionName\": \"ap-southeast-2\"\n      }\n    }\n  ]\n}'\n```\n\n## Step 4\n\nCheck to see if the ```cloudacademy-courses``` global table is ready in the ```ap-southeast-2``` region.\n\n**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.\n\n```\naws dynamodb describe-table \\\n    --region ap-southeast-2 \\\n    --table-name cloudacademy-courses\n```\n\n## Step 5\n\nSetup 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.\n\n**Note**: This command leverages the [jq utility](https://stedolan.github.io/jq/) to query the json data response for the ```TableStatus``` attribute\n\n```\nwatch -n 30 \"aws dynamodb describe-table \\\n    --region ap-southeast-2 \\\n    --table-name cloudacademy-courses \\\n    | jq -r .Table.TableStatus\"\n```\n\n## Step 6\n\nStart up ```tmux``` and split the terminal. \n\n**Pane 1**: Run the following command to query for a new record which we will load in the second tmux pane.\n\n```\nwatch -n1 \"aws dynamodb get-item --region ap-southeast-2 --table-name cloudacademy-courses --key '{\\\"courseid\\\" : {\\\"S\\\" : \\\"6666666\\\"}}'\"\n```\n\n**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.\n\n```\naws dynamodb batch-write-item --region us-west-2 --request-items file://./batch.course.data2.json\n```","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloudacademy%2Fdynamodb-globaltables","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcloudacademy%2Fdynamodb-globaltables","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloudacademy%2Fdynamodb-globaltables/lists"}