-
Notifications
You must be signed in to change notification settings - Fork 48
Added serverless service config #103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
node_modules | ||
.DS_Store | ||
.serverless |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
service: dynamodb-backup | ||
frameworkVersion: "=1.26.0" | ||
|
||
provider: | ||
name: aws | ||
runtime: nodejs6.10 | ||
region: ap-southeast-2 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. May be better not to specify region or to use a command line option instead |
||
|
||
iamRoleStatements: | ||
- Effect: "Allow" | ||
Action: | ||
- "logs:CreateLogGroup" | ||
- "logs:CreateLogStream" | ||
- "logs:PutLogEvents" | ||
Resource: "arn:aws:logs:*:*:*" | ||
- Effect: "Allow" | ||
Action: | ||
- "s3:ListBucket" | ||
Resource: "<YOUR BACKUP BUCKET NAME>" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If the environment variables were global (instead of per-function), we could retrieve this without users having to replace them manually |
||
- Effect: "Allow" | ||
Action: | ||
- "s3:GetObject" | ||
- "s3:PutObject" | ||
- "s3:DeleteObject" | ||
Resource: "arn:aws:s3:::<YOUR BACKUP BUCKET NAME>/*" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above |
||
- Effect: "Allow" | ||
Action: "lambda:InvokeFunction" | ||
Resource: "*" | ||
- Effect: "Allow" | ||
Action: | ||
- "dynamodb:DescribeStream" | ||
- "dynamodb:GetRecords" | ||
- "dynamodb:GetShardIterator" | ||
- "dynamodb:ListStreams" | ||
Resource: "*" | ||
|
||
package: | ||
include: | ||
- ./*.js | ||
- ./node_modules | ||
|
||
functions: | ||
index: | ||
handler: index.backup | ||
|
||
events: | ||
- stream: <YOUR DYNAMODB STREAM ARN> | ||
|
||
environment: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It might be better to move this to the global section so that we can reference them in other parts of the |
||
BackupRegion: <YOUR REGION> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These could be retrieved as environment variables: |
||
BackupBucket: <YOUR BACKUP BUCKET NAME> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above |
||
BackupPrefix: <YOUR PREFIX> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above |
||
|
||
resources: | ||
Resources: | ||
BackupBucket: | ||
Type: AWS::S3::Bucket | ||
Properties: | ||
BucketName: <YOUR BACKUP BUCKET NAME> | ||
VersioningConfiguration: | ||
Status: "Enabled" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can update this to Node 8 now 😄