rrahul963 / serverless-create-global-dynamodb-table

serverless plugin that would create global dynamodb tables for specified tables
Apache License 2.0
25 stars 17 forks source link

Support for PAY_PER_REQUEST billing mode #12

Closed iaforek closed 5 years ago

iaforek commented 5 years ago

I've got following error:

CreateGlobalTable: Failed to setup global table. Error 2 validation errors detected: Value '0' at 'provisionedThroughput.writeCapacityUnits' failed to satisfy constraint: Member must have value greater than or equal to 1; Value '0' at 'provisionedThroughput.readCapacityUnits' failed to satisfy constraint: Member must have value greater than or equal to 1

Because I don't use provisioned throughput. Instead, I use:

          "BillingMode": "PAY_PER_REQUEST",

Can you add support for on-demand capacity mode?

rrahul963 commented 5 years ago

@iaforek - are you using createSatck: false in your config? Also, can you share your serverless.yml file please

iaforek commented 5 years ago

Yes, I initially used createSatck: false and received validation error. I also later changed it to true and then I've got:

CreateGlobalTable: Failed to setup global table. Error Requires capabilities : [CAPABILITY_NAMED_IAM]

In serverless.yml my DynamoDB is actually configured in resources like this:

...
resources: ${file(config.json):resources}

and here is the config.json part:

{
    ...
  "resources": {
    "Resources": {
      "MyDynamoTable": {
        "Type": "AWS::DynamoDB::Table",
        "Properties": {
          "AttributeDefinitions": [
            {
              "AttributeName": "id",
              "AttributeType": "S"
            }
          ],
          "KeySchema": [
            {
              "AttributeName": "id",
              "KeyType": "HASH"
            }
          ],
          "BillingMode": "PAY_PER_REQUEST",
          "SSESpecification": {
            "SSEEnabled": true
          },
          "TableName": "${opt:stage, self:provider.stage}-my-table",
          "TimeToLiveSpecification": {
            "AttributeName": "_ttl",
            "Enabled": true
          }
        }
      },
...
}
rrahul963 commented 5 years ago

@iaforek - i have added support for billing mode in v2.1.0 when using createStack: true