-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtemplate.yml
51 lines (48 loc) · 1.51 KB
/
template.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
AWSTemplateFormatVersion: 2010-09-09
Description: LambdaSAM deployment stack.
Transform: AWS::Serverless-2016-10-31
Parameters:
ProjectName:
Type: String
Description: Project/ecr repositroy name.
Default: screenshuttle
ImageTag:
Type: String
Description: Image tag for the image to be deployed. Keep this as commit id to ensure cfn records the change during deployment
Default: commit-id-here
Resources:
ScreenshuttleLambda:
Type: AWS::Serverless::Function
Properties:
MemorySize: 2048
Timeout: 150
Architectures:
- x86_64
EphemeralStorage:
Size: 512
EventInvokeConfig:
MaximumEventAgeInSeconds: 21600
MaximumRetryAttempts: 2
FunctionName: !Ref ProjectName
ImageUri: !Sub "${AWS::AccountId}.dkr.ecr.eu-west-1.amazonaws.com/${ProjectName}:${ImageTag}"
PackageType: Image
Policies:
- Statement:
- Effect: Allow
Action:
- logs:CreateLogGroup
Resource: !Sub "arn:aws:logs:${AWS::Region}:${AWS::AccountId}:*"
- Statement:
- Effect: Allow
Action:
- ecr:BatchGetImage
- ecr:GetDownloadUrlForLayer
Resource: !Sub "arn:aws:logs:${AWS::Region}:${AWS::AccountId}:repository/${ProjectName}"
SnapStart:
ApplyOn: None
Outputs:
FunctionName:
Description: Function name for
Value: !Ref ScreenshuttleLambda
Export:
Name: !Join ["-", [!Ref ProjectName, function]]