Created
May 3, 2018 11:45
-
-
Save adhorn/331c85bdc25cd767e1c7a3f7c68de3f5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #create the initial table with stream enabled in us-east-1 | |
| aws dynamodb create-table \ | |
| --table-name MyGlobalTable \ | |
| --attribute-definitions \ | |
| AttributeName=item_id,AttributeType=S \ | |
| --key-schema \ | |
| AttributeName=item_id,KeyType=HASH \ | |
| --provisioned-throughput \ | |
| ReadCapacityUnits=5,WriteCapacityUnits=5 \ | |
| --stream-specification StreamEnabled=true,StreamViewType=NEW_AND_OLD_IMAGES \ | |
| --region us-east-1 | |
| # create identical table with stream enable in us-west-2 | |
| aws dynamodb create-table \ | |
| --table-name MyGlobalTable \ | |
| --attribute-definitions \ | |
| AttributeName=item_id,AttributeType=S \ | |
| --key-schema \ | |
| AttributeName=item_id,KeyType=HASH \ | |
| --provisioned-throughput \ | |
| ReadCapacityUnits=5,WriteCapacityUnits=5 \ | |
| --stream-specification StreamEnabled=true,StreamViewType=NEW_AND_OLD_IMAGES \ | |
| --region us-west-2 | |
| # create a global table consisting of replica tables previously created. | |
| aws dynamodb create-global-table \ | |
| --global-table-name MyGlobalTable \ | |
| --replication-group RegionName=us-west-2 RegionName=us-east-1 \ | |
| --region us-east-1 | |
| # This should output the following | |
| { | |
| "GlobalTableDescription": { | |
| "GlobalTableStatus": "CREATING", | |
| "GlobalTableName": "MyGlobalTable", | |
| "ReplicationGroup": [ | |
| { | |
| "RegionName": "us-east-1" | |
| }, | |
| { | |
| "RegionName": "us-west-2" | |
| } | |
| ], | |
| "CreationDateTime": 1524553979.752, | |
| "GlobalTableArn": "arn:aws:dynamodb::xxxxxxxxx:global-table/MyGlobalTable" | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment