-
Notifications
You must be signed in to change notification settings - Fork 28
/
serverless.yml
105 lines (100 loc) · 3.06 KB
/
serverless.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
service: route53-backup
package:
excludeDevDependencies: false
individually: true
exclude:
- "**/*"
provider:
name: aws
runtime: python3.7
stackName: ${self:service.name}-stack
environment:
BUCKET: 'route53-backup-data-#{AWS::AccountId}'
functions:
backup-route53:
handler: backup_route53.handle
name: backup-route53
description: Backs up Route53 regularly to a bucket
timeout: 120
memorySize: 512
environment:
RETENTION_PERIOD: ${opt:retention-period, "14"}
events:
- schedule:
name: route53-scheduled-backup-trigger
rate: rate(${opt:backup-interval, "120"} minutes)
enabled: true
input: {}
iamRoleStatementsName: ${self:service.name}-backup-lambda-role
iamRoleStatementsInherit: false
iamRoleStatements:
- Effect: "Allow"
Resource:
- "arn:aws:s3:::route53-backup-data-#{AWS::AccountId}/*"
- "arn:aws:s3:::route53-backup-data-#{AWS::AccountId}"
Action:
- "s3:PutEncryptionConfiguration"
- "s3:PutObject"
- "s3:PutLifecycleConfiguration"
- "s3:PutBucketPolicy"
- "s3:CreateBucket"
- "s3:ListBucket"
- "s3:PutBucketVersioning"
- Effect: "Allow"
Resource: "*"
Action:
- "route53:GetHealthCheck"
- "route53:ListHealthChecks"
- "route53:GetHostedZone"
- "route53:ListHostedZones"
- "route53:ListHostedZonesByName"
- "route53:ListResourceRecordSets"
- "route53:ListTagsForResource"
- "route53:ListTagsForResources"
package:
include:
- route53_utils.py
- backup_route53.py
restore-route53:
handler: restore_route53.handle
name: restore-route53
description: Restores Route53 from backup
timeout: 120
memorySize: 512
iamRoleStatementsName: ${self:service.name}-restore-lambda-role
iamRoleStatementsInherit: false
iamRoleStatements:
- Effect: "Allow"
Resource: "arn:aws:s3:::route53-backup-data-#{AWS::AccountId}/*"
Action:
- "s3:GetObject"
- Effect: "Allow"
Resource: "*"
Action:
- "route53:GetHealthCheck"
- "route53:ListHealthChecks"
- "route53:GetHostedZone"
- "route53:ListHostedZones"
- "route53:ListResourceRecordSets"
- "route53:ListTagsForResource"
- "route53:ListTagsForResources"
- "route53:CreateHostedZone"
- "route53:GetHealthCheck"
- "route53:ChangeResourceRecordSets"
- "route53:ListTagsForResource"
- "route53:ListTagsForResources"
- "route53:CreateHealthCheck"
- "route53:AssociateVPCWithHostedZone"
- "route53:ChangeTagsForResource"
- Effect: "Allow"
Resource: "*"
Action:
- "ec2:DescribeVpcs"
package:
include:
- route53_utils.py
- restore_route53.py
plugins:
- serverless-pseudo-parameters
- serverless-iam-roles-per-function
- serverless-python-requirements