Programatic way of Creating DynamoDB Global Table

0

When We create a dynamoDB global table by API interface using AWS Golang SDK or using AWS CLI interface it always creates it using dynamoDB 2017 version.. But 2017 version has a limitation of adding new replication region with the already data present in other regions. It mandates tables to be empty.. So we are looking for a programmatic way of creating dynamoDB Global table with 2019 version which doesn't have that problem in 2017 version.. Please do let us know is this supported ? And how to achieve this.. Thank you..

질문됨 일 년 전398회 조회
3개 답변
3
수락된 답변

To create a V2019 of DynamoDB Global Table, you need to use the CreateTable API and NOT the CreateGlobalTable API.

When DynamoDB moved to v2019 it aligned with the table class, which is why you are seeing the creation of v2017 using the global table class.

Once you create the table, you call UpdateTable and specify the ReplicaUpdates

aws dynamodb create-table \
    --table-name custT \
    --attribute-definitions AttributeName=pk,AttributeType=S AttributeName=sk,AttributeType=S \
    --key-schema AttributeName=pk,KeyType=HASH AttributeName=sk,KeyType=RANGE \
    --billing-mode PAY_PER_REQUEST

aws dynamodb wait table-exists \
    --table-name custT

aws dynamodb update-table \
--table-name custT \
--replica-updates '[{"Create": {"RegionName": "eu-west-2"}}]'
profile pictureAWS
전문가
답변함 일 년 전
profile pictureAWS
전문가
검토됨 일 년 전
  • Hi Leeroy,

    Thank you so much for the solution. It unblocked me..

    Best Regards Nagappa

  • That's good to hear Nagappa, please feel free to mark the answer as accepted.

  • Accepted Now.. Thank you ..

0

I just created a new table and replicas which are the 2019 version. What version of the SDK and CLI are you using? Which region is the primary DynamoDB table in?

profile pictureAWS
전문가
답변함 일 년 전
  • Thank you for the reply.. Did you create through AWS Console ? I am using aws-sdk-go-v2 SDK .. Also you can use aws CLI to create table and to create global table with two replicas .. When i do create createGlobalTable dynamoDB version becomes 2017..

    aws --version aws-cli/2.8.10 Python/3.10.8 Darwin/21.6.0 source/arm64 prompt/off

    github.com/aws/aws-sdk-go-v2/service/dynamodb v1.17.7

  • I used the AWS CLI: aws-cli/2.4.18 Python/3.8.8 Darwin/21.6.0 exe/x86_64 prompt/off

    Which regions are you using? I created my primary table in ap-southeast-2 and replicas in us-east-1 and eu-west-1.

0

Thank you for the reply.. Did you create through AWS Console ? I am using aws-sdk-go-v2 SDK .. Also you can use aws CLI to create table and to create global table with two replicas .. When i do create createGlobalTable dynamoDB version becomes 2017..

답변함 일 년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠