Serverless-application-model: AWS::Serverless::SimpleTable - Primary Key Type 'Number' creates table with 'String' Primary Key

Created on 12 Apr 2017  路  3Comments  路  Source: aws/serverless-application-model

This template creates a DynamoDB Table with a Primary Key of Type String instead of Number

MySimpleTable:
    Type: 'AWS::Serverless::SimpleTable'
    PrimaryKey:
      Name: id
      Type: Number
    ProvisionedThroughput:
      ReadCapacityUnits: 5
      WriteCapacityUnits: 5

Unless I am misreading the documentation (below), this isn't intended behavior.

screen shot 2017-04-11 at 17 09 26

https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#primary-key-object

All 3 comments

I'm having a similar issue and it seems like the PrimaryKey parameter is ignored entirely. I have it set to Name: button and it still creates pk as id

PrimaryKey should be under properties:

MySimpleTable:
    Type: 'AWS::Serverless::SimpleTable'
    Properties:
      PrimaryKey:
        Name: button
        Type: Number

I will update the spec to include Properties key in examples because many people are tripping over it.

Was this page helpful?
0 / 5 - 0 ratings