service: serverless-dynamodb-backup

custom:
  bucket: EXAMPLE
  dynamoDBTableName: "${opt:stage, self:provider.stage}_EXAMPLE"
  prefix: FOO

provider:
  name: aws
  runtime: nodejs6.10
  stage: staging
  iamRoleStatements:
    - Effect: Allow
      Action:
        - s3:PutObject
      Resource: "arn:aws:s3:::${self:custom.bucket}/${self:custom.prefix}/${self:custom.dynamoDBTableName}/*"
    - Effect: Allow
      Action:
        - "dynamodb:GetRecords"
        - "dynamodb:GetShardIterator"
        - "dynamodb:DescribeStream"
        - "dynamodb:ListStreams"
      Resource: "arn:aws:dynamodb:ap-southeast-1:*:table/${self:custom.dynamoDBTableName}/stream/*"

functions:
  backup:
    handler: handler.backup
    environment:
      STAGE: "${opt:stage, self:provider.stage}"
      BUCKET: "${self:custom.bucket}"
      TABLE: "${self:custom.dynamoDBTableName}"
      PREFIX: "${self:custom.prefix}"
    timeout: 300
