Error property BillingMode not defined during start a sam local API

I got this error during start a SAM local API

Error: [InvalidResourceException(‘TableSizeMapping’, ‘property BillingMode not defined for resource of type AWS::Serverless::SimpleTable’)] (‘TableSizeMapping’, ‘property BillingMode not defined for resource of type AWS::Serverless::SimpleTable’)

This is my table resource definition

TableSizeMapping:
    Type: AWS::Serverless::SimpleTable
    Properties:
      TableName: !Sub "${AWS::StackName}-sizemapping"
      PrimaryKey:
          Name: _id
          Type: String
      BillingMode: PAY_PER_REQUEST

When I remove the BillingMode property, it works fine.

According to the document: https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-resource-simpletable.html

If ProvisionedThroughput is not specified BillingMode will be specified as PAY_PER_REQUEST .

So do I need to explicitly provide the BillingMode value for AWS::Serverless::SimpleTable resources?

Thanks for reading.

Nope… There is not property named BillingMode on the SimpleTable resource.
It can be implied by the lack of a ProvisionedThroughput property.
That is, you can explicitly define ProvisionedThroughput, or leave it off for PAY_PER_REQUEST.

1 Like

Oh, that’s so.
Thanks for your helping.