-
Notifications
You must be signed in to change notification settings - Fork 1
/
template.yaml
51 lines (51 loc) · 1.58 KB
/
template.yaml
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
AWSTemplateFormatVersion: 2010-09-09
Transform: AWS::Serverless-2016-10-31
Description: A simple AWS Lambda function with AWS SAM and SES that notify's movie ticket availability on email
Parameters:
EnvType:
Type: String
Default: dev
AllowedValues:
- dev
- test
- prod
ConstraintDescription: Must specify "dev" (default), "test" or "prod"
Globals:
Function:
Timeout: 3
MemorySize: 128
Runtime: nodejs14.x
Tracing: Active
AutoPublishAlias: !Ref EnvType
Layers:
- !Sub
arn:${AWS::Partition}:lambda:${AWS::Region}:580247275435:layer:LambdaInsightsExtension:14
Architectures:
- x86_64
Resources:
MovieTicketNotifierFunction:
Type: AWS::Serverless::Function
Properties:
Handler: src/resource/handler/app.handler
Description: A simple AWS Lambda function with AWS SAM and SES that notify's movie ticket availability on email
Policies:
- SESCrudPolicy:
IdentityName: EMAIL_ADDRESS
Events:
CloudWatchEvent:
Type: Schedule
Properties:
Schedule: "rate(5 minutes)"
MovieTicketNotifierFunctionLogGroup:
Type: AWS::Logs::LogGroup
DependsOn: MovieTicketNotifierFunction
DeletionPolicy: Delete
UpdateReplacePolicy: Delete
Properties:
LogGroupName: !Sub /${AWS::Partition}/lambda/${MovieTicketNotifierFunction}
RetentionInDays: 14
Outputs:
MovieTicketNotifierFunctionArn:
Value: !GetAtt MovieTicketNotifierFunction.Arn
MovieTicketNotifierFunctionLogGroup:
Value: !Ref MovieTicketNotifierFunctionLogGroup