-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathlambda-template.yml
89 lines (83 loc) · 3.57 KB
/
lambda-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
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
82
83
84
85
86
87
88
89
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: >
Template for building Macondo lambda function. Use
`sam build -t lambda-template.yml` in this directory to build.
# More info about Globals: https://github.com/awslabs/serverless-application-model/blob/master/docs/globals.rst
Globals:
Function:
Timeout: 240
Resources:
MacondoLambdaFunction:
Type: AWS::Serverless::Function # More info about Function Resource: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction
Properties:
FunctionName: "MacondoLambdaFunction"
CodeUri: .
Handler: cmd/lambda/bootstrap
Runtime: provided.al2
MemorySize: 6000 # 4 CPU lowest limit, maybe?
Tracing: Active # https://docs.aws.amazon.com/lambda/latest/dg/lambda-x-ray.html
# Events:
# CatchAll:
# Type: Api # More info about API Event Source: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#api
# Properties:
# Path: /hello
# Method: GET
Environment: # More info about Env Vars: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#environment-object
Variables:
MACONDO_DATA_PATH: /mnt/data/data
MACONDO_NATS_URL: nats://10.0.0.251:4222
MACONDO_TTABLE_MEM_FRACTION: 0.25
MACONDO_KWG_PATH_PREFIX: 2024
GOMEMLIMIT: 5500MiB # lambda uses mebibytes (6000 MiB would be the limit above). Set go mem limit a bit lower.
# https://docs.aws.amazon.com/lambda/latest/dg/gettingstarted-limits.html
# DEBUG: 1
VpcConfig:
# This is the woogles VPC Config ids.
SecurityGroupIds:
- sg-05b3820613e972136
SubnetIds:
- subnet-0957a537f7ee06915
- subnet-00ade167c2786f245
FileSystemConfigs:
# Our EFS mount with lexica files and stuff
- Arn: !Sub arn:aws:elasticfilesystem:${AWS::Region}:${AWS::AccountId}:access-point/fsap-0c06a2b092e4d7046
LocalMountPath: "/mnt/data"
Policies:
- Statement:
- Sid: AWSLambdaVPCAccessExecutionRole
Effect: Allow
Action:
- logs:CreateLogGroup
- logs:CreateLogStream
- logs:PutLogEvents
- ec2:CreateNetworkInterface
- ec2:DescribeNetworkInterfaces
- ec2:DeleteNetworkInterface
Resource: "*"
- Sid: AmazonElasticFileSystemClientFullAccess
Effect: Allow
Action:
- elasticfilesystem:ClientMount
- elasticfilesystem:ClientRootAccess
- elasticfilesystem:ClientWrite
- elasticfilesystem:DescribeMountTargets
Resource: "*"
Metadata:
BuildMethod: makefile
# It's not being created for some reason?
MacondoFunctionLog:
Type: AWS::Logs::LogGroup
Properties:
LogGroupName: !Sub "/aws/lambda/${MacondoLambdaFunction}"
RetentionInDays: 14
Outputs:
# ServerlessRestApi is an implicit API created out of Events key under Serverless::Function
# Find out more about other implicit resources you can reference within SAM
# https://github.com/awslabs/serverless-application-model/blob/master/docs/internals/generated_resources.rst#api
MacondoLambdaFunction:
Description: "Macondo Lambda Function ARN"
Value: !GetAtt MacondoLambdaFunction.Arn
MacondoLambdaFunctionIamRole:
Description: "Implicit IAM Role created for Macondo Lambda function"
Value: !GetAtt MacondoLambdaFunctionRole.Arn