-
Notifications
You must be signed in to change notification settings - Fork 0
/
template.yml
executable file
·107 lines (96 loc) · 3.56 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
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
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: poja-soratra-std21099 - Computation and API
Globals:
Function:
CodeUri: .
Runtime: java21
Tracing: Active
Architectures:
- x86_64
Timeout: 600
EventInvokeConfig:
MaximumRetryAttempts: 0
VpcConfig:
SecurityGroupIds:
- !Sub '{{resolve:ssm:/poja/sg/id}}'
SubnetIds:
- !Sub '{{resolve:ssm:/poja/subnet/private1/id}}'
- !Sub '{{resolve:ssm:/poja/subnet/private2/id}}'
Environment:
Variables:
ENV: !Ref Env
AWS_SQS_QUEUE_URL: !Sub '{{resolve:ssm:/poja-soratra-std21099/${Env}/sqs/mailbox-queue-url}}'
AWS_EVENTBRIDGE_BUS: !Sub '{{resolve:ssm:/poja-soratra-std21099/${Env}/eventbridge/bus-name}}'
AWS_S3_BUCKET: !Sub '{{resolve:ssm:/poja-soratra-std21099/${Env}/s3/bucket-name}}'
AWS_SES_SOURCE: noreply@nowhere.com
DRIVERCLASSNAME: org.sqlite.JDBC
SPRING_JPA_DATABASEPLATFORM: org.hibernate.community.dialect.SQLiteDialect
SPRING_DATASOURCE_URL: jdbc:sqlite:/mnt/efs/sqlite-data:db?cache=shared
SPRING_DATASOURCE_USERNAME: sa
SPRING_DATASOURCE_PASSWORD: sa
JAVA_TOOL_OPTIONS: -XX:+TieredCompilation -XX:TieredStopAtLevel=1 -Dspring.main.lazy-initialization=true -Dspring.data.jpa.repositories.bootstrap-mode=lazy -Dspring.datasource.max-active=5 -Dspring.datasource.max-idle=1 -Dspring.datasource.min-idle=1 -Dspring.datasource.initial-size=1
Parameters:
Env:
Type: String
Resources:
FrontalServerlessRestApi:
Type: AWS::Serverless::Api
Properties:
StageName: Prod
BinaryMediaTypes:
- "*~1*"
FrontalFunction:
Type: AWS::Serverless::Function
Properties:
Handler: hei.school.soratra.ApiEventHandler::handleRequest
MemorySize: 2048
Role: !Sub '{{resolve:ssm:/poja-soratra-std21099/${Env}/execution/role-arn}}'
FileSystemConfigs:
- Arn: !Sub '{{resolve:ssm:/poja-soratra-std21099/${Env}/efs/access-point/arn}}'
LocalMountPath: /mnt/efs
Events:
ApiCall:
Type: Api
Properties:
Path: /{proxy+}
Method: ANY
RestApiId:
Ref: FrontalServerlessRestApi
WorkerFunction:
Type: AWS::Serverless::Function
Properties:
Handler: hei.school.soratra.MailboxEventHandler::handleRequest
MemorySize: 1024
Role: !Sub '{{resolve:ssm:/poja-soratra-std21099/${Env}/execution/role-arn}}'
FileSystemConfigs:
- Arn: !Sub '{{resolve:ssm:/poja-soratra-std21099/${Env}/efs/access-point/arn}}'
LocalMountPath: /mnt/efs
Events:
AllEvents:
Type: SQS
Properties:
Queue: !Sub '{{resolve:ssm:/poja-soratra-std21099/${Env}/sqs/mailbox-queue-arn}}'
BatchSize: 5
ApplicationResourceGroup:
Type: AWS::ResourceGroups::Group
Properties:
Name:
Fn::Sub: ApplicationInsights-SAM-${AWS::StackName}
ResourceQuery:
Type: CLOUDFORMATION_STACK_1_0
ApplicationInsightsMonitoring:
Type: AWS::ApplicationInsights::Application
Properties:
ResourceGroupName: !Ref ApplicationResourceGroup
AutoConfigurationEnabled: 'true'
ApiUrlSSM:
Type: AWS::SSM::Parameter
Properties:
Name: !Join [ '', [ /poja-soratra-std21099/, !Ref Env, /api/url ] ]
Type: String
Value: !Sub "https://${FrontalServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod"
Outputs:
ApiUrl:
Description: API Gateway endpoint URL
Value: !GetAtt ApiUrlSSM.Value