-
Notifications
You must be signed in to change notification settings - Fork 0
/
template.yaml
78 lines (70 loc) · 1.86 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
AWSTemplateFormatVersion: "2010-09-09"
Transform: AWS::Serverless-2016-10-31
Description: Base infrastructure with authorization Lambda, API Gateway, and base Lambda
Parameters:
FolderRoot:
Type: String
Default: build
Globals:
Function:
Environment:
Variables:
AWS_XRAY_CONTEXT_MISSING: LOG_ERROR
AWS_XRAY_LOG_LEVEL: silent
Resources:
BunLayer:
Type: AWS::Lambda::LayerVersion
Properties:
Content: ./bun-layer
CompatibleRuntimes:
- provided.al2
Description: Layer containing Bun.js runtime
AuthLambda:
Type: AWS::Serverless::Function
Properties:
Handler: index.fetch
Runtime: provided.al2
CodeUri: !Sub ${FolderRoot}/auth-lambda/
Tracing: Active
Environment:
# Variables:
# Add your environment variables here
Layers:
- !Ref BunLayer
ApiGateway:
Type: AWS::Serverless::Api
Properties:
StageName: Prod
DefinitionBody:
Fn::Transform:
Name: AWS::Include
Parameters:
Location: ./api-definition.yaml
BaseLambda:
Type: AWS::Serverless::Function
Properties:
Handler: index.fetch
Runtime: provided.al2
CodeUri: !Sub ${FolderRoot}/base-lambda/
Tracing: Active
Environment:
# Variables:
# Add your environment variables here
Layers:
- !Ref BunLayer
Events:
BaseLambdaPost:
Type: Api
Properties:
Path: /baselambda
Method: POST
RestApiId: !Ref ApiGateway
Auth:
Authorizer: LambdaAuth
Outputs:
AuthLambdaArn:
Description: Authorization Lambda ARN
Value: !GetAtt AuthLambda.Arn
ApiGatewayEndpoint:
Description: API Gateway Endpoint URL
Value: !Sub "https://${ApiGateway}.execute-api.${AWS::Region}.amazonaws.com/Prod/"