Sample Header Ad - 728x90

Unable to create a GSI on dynamodb from aws cli on local

1 vote
0 answers
35 views
I am trying to add a GSI to an existing table on dynamo DB on local. I downloaded the last version(2.5.1) and run ti with: `java -Djava.library.path=./DynamoDBLocal_lib -jar DynamoDBLocal.jar -sharedDb -port 8001 Creatiing a table works fine:
aws dynamodb create-table  
--endpoint-url http://localhost:8001    
--table-name GameScores2     
--attribute-definitions AttributeName=GameTitle,AttributeType=S  AttributeName=UserId,AttributeType=S    
--key-schema AttributeName=UserId,KeyType=HASH AttributeName=GameTitle,KeyType=RANGE     
--provisioned-throughput ReadCapacityUnits=10,WriteCapacityUnits=5
But when i try to create a GSI, just like in the amazon docs says:
aws dynamodb update-table     --endpoint-url http://localhost:8001     --table-name GameScores2     --attribute-definitions AttributeName=TopScore,AttributeType=N      --global-secondary-index-updates         "[                                                                                                                                                                  
            {
                \"Create\": {
                    \"IndexName\": \"GameTitleIndex\",
                    \"KeySchema\": [{\"AttributeName\":\"GameTitle\",\"KeyType\":\"HASH\"},
                                    {\"AttributeName\":\"TopScore\",\"KeyType\":\"RANGE\"}],
                    \"Projection\":{
                        \"ProjectionType\":\"INCLUDE\",
                        \"NonKeyAttributes\":[\"UserId\"]
                    }
                }
            }
        ]"
Always get the error An error occurred (InternalFailure) when calling the UpdateTable operation (reached max retries: 9): The request processing has failed because of an unknown error, exception or failure. I've searched all over internet but as far as I can see the syntax is ok, the db is running, I have the last version... Any idea of what can be happening? If I try to create the table directly with the GSI it works without error, But I need to update an existing table.
Asked by Tesouro (11 rep)
Jul 9, 2024, 10:51 AM
Last activity: Apr 9, 2025, 09:26 AM