0

I'm using dynamodb Local. I'm trying to assign two addresses to one person but I'm getting a "Duplicate Key" error. I want to add more countries and more addresses for one single person. but whenever I try to add another country and address for the person it gives a Duplicate Key error

Can someone pls help me out? Help is appreciated. The image of my localhost code

{
  "AttributeDefinitions": [
    {
      "AttributeName": "AddressID",
      "AttributeType": "S"
    },
    {
      "AttributeName": "CustomerID",
      "AttributeType": "S"
    },
    {
      "AttributeName": "Country",
      "AttributeType": "S"
    }
  ],
  "TableName": "Addresses",
  "KeySchema": [
    {
      "AttributeName": "AddressID",
      "KeyType": "HASH"
    },
    {
      "AttributeName": "CustomerID",
      "KeyType": "RANGE"
    }
  ],
  "TableStatus": "ACTIVE",
  "CreationDateTime": "2021-04-06T09:06:29.622Z",
  "ProvisionedThroughput": {
    "LastIncreaseDateTime": "1970-01-01T00:00:00.000Z",
    "LastDecreaseDateTime": "1970-01-01T00:00:00.000Z",
    "NumberOfDecreasesToday": 0,
    "ReadCapacityUnits": 5,
    "WriteCapacityUnits": 5
  },
  "TableSizeBytes": 732,
  "ItemCount": 6,
  "TableArn": "arn:aws:dynamodb:ddblocal:000000000000:table/Addresses",
  "GlobalSecondaryIndexes": [
    {
      "IndexName": "UserIndex",
      "KeySchema": [
        {
          "AttributeName": "AddressID",
          "KeyType": "HASH"
        },
        {
          "AttributeName": "Country",
          "KeyType": "RANGE"
        }
      ],
      "Projection": {
        "ProjectionType": "ALL"
      },
      "IndexStatus": "ACTIVE",
      "ProvisionedThroughput": {
        "ReadCapacityUnits": 5,
        "WriteCapacityUnits": 5
      },
      "IndexSizeBytes": 732,
      "ItemCount": 6,
      "IndexArn": "arn:aws:dynamodb:ddblocal:000000000000:table/Addresses/index/UserIndex"
    }
  ]
}
Hassan
  • 101
  • 1
  • 1
  • 6

0 Answers0