3

I want to create dynamodb tables in localhost I have downloaded my remote dynamodb tables using this script.

https://github.com/bchew/dynamodump

This script I got from this answer over here. How to export an existing dynamo table schema to json?

And I got a local back up of all the tables in my local machine Now I want to create those tables in my dynamodb local system for that reason I am uploading my tables to local DB using this command.

sudo aws  dynamodb create-table --cli-input-json file:///home/evbooth/Desktop/dynamo/table/dynamodump/dump/admin/schema.json --endpoint-url http://localhost:8000

But I am getting an error like this.

Parameter validation failed:
Missing required parameter in input: "AttributeDefinitions"
Missing required parameter in input: "TableName"
Missing required parameter in input: "KeySchema"
Missing required parameter in input: "ProvisionedThroughput"
Unknown parameter in input: "Table", must be one of: AttributeDefinitions, TableName, KeySchema, LocalSecondaryIndexes, GlobalSecondaryIndexes, ProvisionedThroughput, StreamSpecification, SSESpecification

The downloaded json file is like this.

{
  "Table": {
    "TableArn": "arn:aws:dynamodb:us-west-2:xxxx:table/admin", 
    "AttributeDefinitions": [
      {
        "AttributeName": "userid", 
        "AttributeType": "S"
      }
    ], 
    "ProvisionedThroughput": {
      "NumberOfDecreasesToday": 0, 
      "WriteCapacityUnits": 1, 
      "ReadCapacityUnits": 1
    }, 
    "TableSizeBytes": 0, 
    "TableName": "admin", 
    "TableStatus": "ACTIVE", 
    "TableId": "fd21aaab-52fe-4f86-aba6-1cc9a7b17417", 
    "KeySchema": [
      {
        "KeyType": "HASH", 
        "AttributeName": "userid"
      }
    ], 
    "ItemCount": 0, 
    "CreationDateTime": 1403367027.739
  }
}

How can i fix this? I really got annoyed with aws dont have much idea about dynamo db as well

4
  • It looks as though the aws command is expecting the contents of "Table" as the top-level input, but instead it's seeing this thing called "Table" that it doesn't know what to do with. Try removing line 2 and the penultimate line in your example JSON file and see what happens. Commented Jul 31, 2018 at 15:42
  • @wolfson109 The JSON i have formatted is like this { "AttributeDefinitions": [ { "AttributeName": "userid", "AttributeType": "S" } ], "ProvisionedThroughput": { "NumberOfDecreasesToday": 0, "WriteCapacityUnits": 1, "ReadCapacityUnits": 1 }, "TableSizeBytes": 0, "TableName": "admin", "TableStatus": "ACTIVE", "TableId": "fd21aaab-52fe-4f86-aba6-1cc9a7b17417", "KeySchema": [ { "KeyType": "HASH", "AttributeName": "userid" } ] } Commented Jul 31, 2018 at 17:10
  • But it gives error Parameter validation failed: Unknown parameter in input: "TableSizeBytes", must be one of: AttributeDefinitions, TableName, KeySchema, LocalSecondaryIndexes, GlobalSecondaryIndexes, ProvisionedThroughput, StreamSpecification, SSESpecification Unknown parameter in input: "TableStatus", must be one of: AttributeDefinitions, TableName, KeySchema, LocalSecondaryIndexes, GlobalSecondaryIndexes, ProvisionedThroughput, StreamSpecification, SSESpecification Unknown parameter in input: "TableId", must be one of: AttributeDefinitions, Commented Jul 31, 2018 at 17:12
  • TableName, KeySchema, LocalSecondaryIndexes, GlobalSecondaryIndexes, ProvisionedThroughput, StreamSpecification, SSESpecification Unknown parameter in ProvisionedThroughput: "NumberOfDecreasesToday", must be one of: ReadCapacityUnits, WriteCapacityUnits Commented Jul 31, 2018 at 17:12

2 Answers 2

1

@wolfson thank you for your suggestion after working some time removing these stuff from the schema helped me to create a table anyway. I removed

1)"Table": {
        "TableArn": "arn:aws:dynamodb:us-west-2:xxxx:table/admin",

2)"NumberOfDecreasesToday": 0,
3), 
        "ItemCount": 0, 
        "CreationDateTime": 1403367027.739
      }
4)"TableSizeBytes": 0,
5) 
        "TableStatus": "ACTIVE", 
        "TableId": "fd21aaab-52fe-4f86-aba6-1cc9a7b17417", 

The resultant json is like but i forced to do this for all the tables and made me to do the create table operation n number of tables.

 {       
        "AttributeDefinitions": [
          {
            "AttributeName": "userid", 
            "AttributeType": "S"
          }
        ], 
        "ProvisionedThroughput": {

          "WriteCapacityUnits": 1, 
          "ReadCapacityUnits": 1
        }, 

        "TableName": "admin",
        "KeySchema": [
          {
            "KeyType": "HASH", 
            "AttributeName": "userid"
          }
        ]
    }

Thank you anyway.

Sign up to request clarification or add additional context in comments.

Comments

1

I was able to create the table locally in DynamoDB by removing this completely:

"BillingModeSummary": {
    "BillingMode": "PROVISIONED",
    "LastUpdateToPayPerRequestDateTime": 0
  }

Once the table got created I looked at the table meta information, strangely it contains this:

"BillingModeSummary": {
    "BillingMode": "PROVISIONED",
    "LastUpdateToPayPerRequestDateTime": "1970-01-01T00:00:00.000Z"
  }

I went back and tried to create table using the format as shown above. However it failed. Bottomline just remove "BillingModeSummary" and voila the table got created! :-)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.