-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtemplate.yaml
121 lines (115 loc) · 3.28 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
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: AWS SQS triggering AWS Lambda sending to another AWS SQS
Resources:
LambdaHL7toFHIR:
Type: AWS::Serverless::Function
DependsOn: LambdaExecutionRole
Metadata:
SkipBuild: True
Properties:
CodeUri: target/hl7-fhir-aws-lambda-sqs-0.1.jar
# PackageType: Zip
Handler: systems.conceptual.App::handleRequest
Role: !GetAtt LambdaExecutionRole.Arn
Runtime: java11
MemorySize: 700
Timeout: 15
Architectures:
- x86_64
# EventInvokeConfig:
# MaximumEventAgeInSeconds: 21600
# MaximumRetryAttempts: 2
# EphemeralStorage:
# Size: 512
Environment:
Variables:
PARAM1: VALUE
JAVA_TOOL_OPTIONS: -XX:+TieredCompilation -XX:TieredStopAtLevel=1 # More info about tiered compilation https://aws.amazon.com/blogs/compute/optimizing-aws-lambda-function-performance-for-java/
Events:
SQS1:
Type: SQS
Properties:
Queue:
Fn::GetAtt:
- QueueHL7
- Arn
BatchSize: 10
RuntimeManagementConfig:
UpdateRuntimeOn: Auto
SnapStart:
ApplyOn: None
QueueHL7:
Type: AWS::SQS::Queue
Properties:
QueueName: hl7-queue
SqsManagedSseEnabled: true
# DelaySeconds: 0
# VisibilityTimeout: 120
RedrivePolicy:
deadLetterTargetArn:
Fn::GetAtt:
- QueueFailedHL7
- Arn
maxReceiveCount: 10
QueueFailedHL7:
Type: AWS::SQS::Queue
Properties:
QueueName: hl7-failed-queue
SqsManagedSseEnabled: true
QueueFHIR:
Type: AWS::SQS::Queue
Properties:
QueueName: fhir-queue
SqsManagedSseEnabled: true
# DelaySeconds: 0
# VisibilityTimeout: 120
# Lambda permissions
LambdaExecutionRole:
Type: AWS::IAM::Role
Properties:
AssumeRolePolicyDocument:
Version: '2012-10-17'
Statement:
- Effect: Allow
Principal:
Service:
- lambda.amazonaws.com
Action:
- sts:AssumeRole
Policies:
- PolicyName: allowLambdaLogs
PolicyDocument:
Version: '2012-10-17'
Statement:
- Effect: Allow
Action:
- logs:*
Resource: arn:aws:logs:*:*:*
# Incoming Queue
- PolicyName: allowIncomingSqs
PolicyDocument:
Version: '2012-10-17'
Statement:
- Effect: Allow
Action:
- sqs:ReceiveMessage
- sqs:DeleteMessage
- sqs:GetQueueUrl
- sqs:GetQueueAttributes
- sqs:ChangeMessageVisibility
Resource: !GetAtt QueueHL7.Arn
# Outgoing Queue
- PolicyName: allowOutgoingSqs
PolicyDocument:
Version: '2012-10-17'
Statement:
- Effect: Allow
Action:
- sqs:SendMessage
- sqs:ReceiveMessage
- sqs:DeleteMessage
- sqs:GetQueueUrl
- sqs:GetQueueAttributes
- sqs:ChangeMessageVisibility
Resource: !GetAtt QueueFHIR.Arn