serverless-sam
Version:
Serverless framework plugin to export AWS SAM templates for a service
34 lines (30 loc) • 922 B
YAML
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