-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtemplate.yaml
More file actions
89 lines (81 loc) · 2.31 KB
/
template.yaml
File metadata and controls
89 lines (81 loc) · 2.31 KB
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
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: UML Diagram Generator API (Local Development)
Globals:
Function:
Timeout: 180 # 3 minutos para Lambda
MemorySize: 1024
Runtime: python3.12
Environment:
Variables:
GOOGLE_API_KEY: !Ref GoogleApiKey
GEMINI_MODEL_NAME: !Ref GeminiModelName
Parameters:
GoogleApiKey:
Type: String
Description: Google Gemini API Key
NoEcho: true
Default: "XXXXXX"
GeminiModelName:
Type: String
Description: Gemini model name
Default: "gemini-2.5-flash"
Resources:
# Lambda Layer for dependencies
DependenciesLayer:
Type: AWS::Serverless::LayerVersion
Properties:
LayerName: uml-generator-dependencies
Description: Dependencies for UML Generator
ContentUri: layers/dependencies/
CompatibleRuntimes:
- python3.12
RetentionPolicy: Delete
Metadata:
BuildMethod: python3.12
# HTTP API for local development
DiagramGeneratorApi:
Type: AWS::Serverless::HttpApi
Properties:
Name: uml-diagram-api
CorsConfiguration:
AllowCredentials: false
AllowHeaders:
- "Content-Type"
- "X-Amz-Date"
- "Authorization"
AllowMethods:
- "POST"
- "OPTIONS"
- "GET"
AllowOrigins:
- "*"
MaxAge: 86400
# Main Lambda Function
UMLGeneratorFunction:
Type: AWS::Serverless::Function
Properties:
FunctionName: uml-diagram-generator
CodeUri: backend/
Handler: src.handlers.main_handler.lambda_handler
Layers:
- !Ref DependenciesLayer
Environment:
Variables:
PYTHONPATH: /opt/python:/var/runtime:/var/task
GOOGLE_API_KEY: !Ref GoogleApiKey
GEMINI_MODEL_NAME: !Ref GeminiModelName
Events:
GenerateDiagram:
Type: HttpApi
Properties:
ApiId: !Ref DiagramGeneratorApi
Path: /generate-diagram
Method: POST
Outputs:
DiagramGeneratorApiEndpoint:
Description: "HTTP API endpoint for UML Generator (local development)"
Value: !Sub "http://localhost:3000/generate-diagram"
UMLGeneratorFunctionArn:
Description: "UML Generator Lambda Function ARN"
Value: !GetAtt UMLGeneratorFunction.Arn