-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtemplate.yaml
More file actions
49 lines (46 loc) · 1.38 KB
/
template.yaml
File metadata and controls
49 lines (46 loc) · 1.38 KB
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
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: >
ContdDeployment
Resources:
ShowMyIpFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: build/showMyIp-1.0-SNAPSHOT.jar
Handler: helloworld.App::handleRequest
Runtime: java8
AutoPublishAlias: myAlias
DeploymentPreference:
Type: Canary10Percent10Minutes
Alarms:
- !Ref NewVersionErrorMetricGreaterThanZeroAlarm
Timeout: 30
MemorySize: 512
Events:
HelloWorld:
Type: Api
Properties:
Path: /showMyIp
Method: get
NewVersionErrorMetricGreaterThanZeroAlarm:
Type: "AWS::CloudWatch::Alarm"
Properties:
AlarmDescription: Lambda Function Error > 0
ComparisonOperator: GreaterThanThreshold
Dimensions:
- Name: Resource
Value: !Sub "${ShowMyIpFunction}:myAlias"
- Name: FunctionName
Value: !Ref ShowMyIpFunction
- Name: ExecutedVersion
Value: !GetAtt ShowMyIpFunction.Version.Version
EvaluationPeriods: 1
MetricName: Errors
Namespace: AWS/Lambda
Period: 300
Statistic: Sum
Threshold: 0
Outputs:
HelloWorldApi:
Description: "API Gateway endpoint URL for Prod stage"
Value: !Sub "https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/showMyIp/"