forked from aws-powertools/powertools-lambda-python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmicro_function_template.yaml
63 lines (59 loc) · 1.85 KB
/
micro_function_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
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: >
micro-function-example
Globals:
Api:
TracingEnabled: true
Cors: # see CORS section
AllowOrigin: "'https://example.com'"
AllowHeaders: "'Content-Type,Authorization,X-Amz-Date'"
MaxAge: "'300'"
BinaryMediaTypes: # see Binary responses section
- "*~1*" # converts to */* for any binary type
Function:
Timeout: 5
Runtime: python3.10
Resources:
# Lambda Function Solely For /users endpoint
AllUsersFunction:
Type: AWS::Serverless::Function
Properties:
Handler: app.lambda_handler
CodeUri: users
Description: Function for /users endpoint
Architectures:
- x86_64
Tracing: Active
Events:
UsersPath:
Type: Api
Properties:
Path: /users
Method: GET
MemorySize: 512 # This Lambda Function can have a higher memory size set
Environment:
Variables:
LOG_LEVEL: INFO
Tags:
LambdaPowertools: python
# Lambda Function Solely For /users/{id} endpoint
UserByIdFunction:
Type: AWS::Serverless::Function
Properties:
Handler: app.lambda_handler
CodeUri: users_by_id
Description: Function for /users/{id} endpoint
Architectures:
- x86_64
Tracing: Active
Events:
UsersByIdPath:
Type: Api
Properties:
Path: /users/{id+}
Method: GET
MemorySize: 128
Environment:
Variables:
LOG_LEVEL: INFO