-
Notifications
You must be signed in to change notification settings - Fork 0
/
serverless.yml
49 lines (45 loc) · 1.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
service: dns-lambda
provider:
name: aws
region: eu-west-1
runtime: python3.8
memorySize: 128
deploymentBucket: ${env:DEPLOYMENT_BUCKET}
iamRoleStatements:
- Effect: Allow
Action: "ec2:*"
Resource: "*"
- Effect: Allow
Action: "route53:*"
Resource: "*"
environment:
DOMAIN_NAME: ${env:DOMAIN_NAME}
HOSTED_ZONE_ID: ${env:HOSTED_ZONE_ID}
functions:
createRecord:
handler: src/dns_lambda.create_record
events:
- cloudwatchEvent:
event:
source:
- aws.ec2
detail-type:
- EC2 Instance State-change Notification
detail:
state:
- running
deleteRecord:
handler: src/dns_lambda.delete_record
events:
- cloudwatchEvent:
event:
source:
- aws.ec2
detail-type:
- EC2 Instance State-change Notification
detail:
state:
- stopped
- terminated
plugins:
- serverless-python-requirements