I am getting the following error when calling my lambda skill
ClientError: An error occurred (ValidationException)
when calling the CreateTable operation: 1 validation error detected:
Value '[com.amazonaws.dynamodb.v20120810.KeySchemaElement@2273ace6,
com.amazonaws.dynamodb.v20120810.KeySchemaElement@4d13ab9,
com.amazonaws.dynamodb.v20120810.KeySchemaElement@115e22b2]' at
'keySchema' failed to satisfy constraint: Member must have length less than or equal to 2
Here is the code:
def write_values_to_db(ddid, token, intent):
pid = ...
dynamodb_client = boto3.client('dynamodb')
try:
response = dynamodb_client.create_table(
AttributeDefinitions=[
{
'AttributeName': 'pid',
'AttributeType': 'S',
},
{
'AttributeName': 'ddid',
'AttributeType': 'S',
},
{
'AttributeName': 'token',
'AttributeType': 'S',
},
],
KeySchema=[
{
'AttributeName': 'pid',
'KeyType': 'HASH',
},
{
'AttributeName': 'ddid',
'KeyType': 'RANGE',
},
{
'AttributeName': 'token',
'KeyType': 'RANGE',
},
],
ProvisionedThroughput={
'ReadCapacityUnits': 5,
'WriteCapacityUnits': 5,
},
TableName='Values',
)
except dynamodb_client.exceptions.ResourceInUseException:
dynamodb_client.put_item(
TableName='Values',
Item={
'pid': pid,
'ddid': ddid,
'token': token
}
)
According to my dashboard the error is on the TableName='Values' line. I was following a tutorial and only changed certain things so I don't see why this is not working. I can't test on a local environment because I have region/credential issues.