-
Notifications
You must be signed in to change notification settings - Fork 0
/
serverless.yml
81 lines (74 loc) · 1.88 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
service: MV-${env:REALM}-GoCD-Agent-Cleanup
provider:
name: aws
runtime: python3.11
stage: ${env:ENV}
memorySize: 128
timeout: 120
versionFunctions: false
region: ${env:AWS_REGION}
stackTags:
FRAMEWORK: serverless
environment:
ENV: ${env:ENV}
LOGLEVEL: ${env:LOGLEVEL}
REALM: ${env:REALM}
GOCD_USERNAME: ${env:GOCD_USERNAME}
GOCD_PASSWORD: ${env:GOCD_PASSWORD}
GOCD_URL: ${env:GOCD_URL}
package:
artifact: package/package.zip
plugins:
- serverless-plugin-aws-alerts
custom:
alerts:
dashboards: true
topics:
ok: ${env:OPS_GENIE_SNS_ARN}
alarm: ${env:OPS_GENIE_SNS_ARN}
insufficientData: ${env:OPS_GENIE_SNS_ARN}
definitions:
functionErrors:
threshold: 10
period: 900
functionDuration:
threshold: 60000
statistic: 'p95'
period: 900
alarms:
- functionErrors
- functionThrottles
- functionInvocations
- functionDuration
functions:
handler:
handler: gocd_agent_cleanup.handler
events:
- schedule: cron(0 */1 * * ? *)
vpc:
securityGroupIds:
- Ref: GoCDAgentClenupLambdaSG
- ${env:AWS_INTERNET_ACCESS_SG}
subnetIds:
- ${env:AWS_SUBNET_A}
- ${env:AWS_SUBNET_B}
resources:
Resources:
GoCDAgentClenupLambdaSG:
Type: "AWS::EC2::SecurityGroup"
Properties:
GroupDescription: "${self:service}-${env:ENV} SG for access to GoCD Server"
VpcId: ${env:AWS_VPC_ID}
GoCDSecurityGroupIngress:
Type: "AWS::EC2::SecurityGroupIngress"
Properties:
SourceSecurityGroupId:
Fn::GetAtt: [ "GoCDAgentClenupLambdaSG", "GroupId" ]
GroupId: "${env:AWS_GOCD_LB_SG}"
IpProtocol: "tcp"
FromPort: 443
ToPort: 443
Outputs:
GoCDAgentClenupLambdaSGID:
Value:
Fn::GetAtt: [ "GoCDAgentClenupLambdaSG", "GroupId" ]