-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtemplate.yaml
executable file
·97 lines (91 loc) · 2.4 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
AWSTemplateFormatVersion: 2010-09-09
Transform: AWS::Serverless-2016-10-31
Description: test
# More info about Globals: https://github.com/awslabs/serverless-application-model/blob/master/docs/globals.rst
Globals:
Function:
Timeout: 60
MemorySize: 768
Runtime: nodejs18.x
Parameters:
StackName:
Type: String
Default: 'TestStack'
RoleName:
Type: String
Default: 'TestRole'
PolicyName:
Type: String
Default: 'TestPolicy'
Resources:
LambdaExecutionRole:
Type: AWS::IAM::Role
Properties:
RoleName: !Ref RoleName
AssumeRolePolicyDocument:
Version: '2012-10-17'
Statement:
- Effect: Allow
Principal:
Service:
- lambda.amazonaws.com
Action:
- sts:AssumeRole
Path: "/"
ManagedPolicyArns:
- "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
Policies:
- PolicyName: !Ref PolicyName
PolicyDocument:
Version: '2012-10-17'
Statement:
- Effect: Allow
Action:
- ec2:CreateNetworkInterface
- ec2:DescribeNetworkInterfaces
- ec2:DeleteNetworkInterface
Resource: '*'
Api:
Type: AWS::Serverless::Api
Properties:
MinimumCompressionSize: 0
OpenApiVersion: 3.0.1
DefinitionUri: ./template_api.yaml
StageName: Test
TracingEnabled: false
CacheClusterEnabled: false
MethodSettings:
- DataTraceEnabled: true
HttpMethod: '*'
LoggingLevel: ERROR
ResourcePath: '/*'
MetricsEnabled: true
Variables:
ServerlessLambdaFunctionName: !Ref LambdaApiFunction
LambdaApiFunction:
Type: AWS::Serverless::Function
Properties:
Description: ai api
FunctionName: 'test'
CodeUri: ./
Handler: dist/lambda.handler
Role: !GetAtt LambdaExecutionRole.Arn
Events:
health:
Type: Api
Properties:
Path: '/health'
Method: GET
RestApiId: !Ref Api
# carCheck:
# Type: Api
# Properties:
# Path: '/car-check'
# Method: GET
# RestApiId: !Ref Api
proxy:
Type: Api
Properties:
Path: '/{proxy+}'
Method: ANY
RestApiId: !Ref Api