1

I am writing a serverless application. It uses an already created dynamodb table and hence configured properly in serverless.yml file. Now, I want to run mock test locally using serverless-offline and serverless-dynamodb-local plugin. The problem is these plugins require table definition in serverless.yml file and if I add it, it will also deploy dynamodb table, which is not desired.

Currently, I have this configuration:

custom:
  dynamodb:
    subscribeTableName:       tablename
    subscribeTableARN:        tablearn        
    subscribeTableStreamARN:  tablestreamarn

and nothing under resource. Whereas test plugins require it to be something like this:

custom:

  dynamodb:
  # If you only want to use DynamoDB Local in some stages, declare them here
    stages:
      - dev
    start:
      port: 8000
      inMemory: true
      heapInitial: 200m
      heapMax: 1g
      migrate: true

  resources:
    Resources:
      usersTable:
        Type: AWS::DynamoDB::Table
        Properties:
          TableName: usersTable
          AttributeDefinitions:
            - AttributeName: email
              AttributeType: S
          KeySchema:
            - AttributeName: email
              KeyType: HASH 
          ProvisionedThroughput:
            ReadCapacityUnits: 1
            WriteCapacityUnits: 1

Is there a way I can either prevent it from deploying using this config or achieve this in another way?

Usama Shahid
  • 110
  • 11

0 Answers0