This repository was archived by the owner on Jul 18, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 391
Expand file tree
/
Copy pathtemplate.yaml
More file actions
93 lines (81 loc) · 2.33 KB
/
template.yaml
File metadata and controls
93 lines (81 loc) · 2.33 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
90
91
92
93
AWSTemplateFormatVersion: "2010-09-09"
Transform: 'AWS::Serverless-2016-10-31'
Parameters:
Environment:
Type: String
Default: dev
Description: Environment name
LogLevel:
Type: String
Default: INFO
RetentionInDays:
Type: Number
Default: 30
Description: CloudWatch Logs retention period for Lambda functions
Globals:
Function:
Runtime: python3.9
Architectures:
- arm64
Handler: main.handler
Timeout: 30
Tracing: Active
Environment:
Variables:
ENVIRONMENT: !Ref Environment
POWERTOOLS_SERVICE_NAME: delivery-pricing
POWERTOOLS_TRACE_DISABLED: "false"
LOG_LEVEL: !Ref LogLevel
Layers:
- !Sub "arn:aws:lambda:${AWS::Region}:580247275435:layer:LambdaInsightsExtension-Arm64:1"
Resources:
PricingFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: src/pricing/
Events:
BackendApi:
Type: Api
Properties:
Path: /backend/pricing
Method: POST
RestApiId: !Ref Api
Policies:
- arn:aws:iam::aws:policy/CloudWatchLambdaInsightsExecutionRolePolicy
PricingLogGroup:
Type: AWS::Logs::LogGroup
Properties:
LogGroupName: !Sub "/aws/lambda/${PricingFunction}"
RetentionInDays: !Ref RetentionInDays
###############
# API GATEWAY #
###############
Api:
Type: AWS::Serverless::Api
Properties:
DefinitionBody:
Fn::Transform:
Name: "AWS::Include"
Parameters:
Location: "resources/openapi.yaml"
EndpointConfiguration: REGIONAL
StageName: prod
TracingEnabled: true
ApiArnParameter:
Type: AWS::SSM::Parameter
Properties:
Name: !Sub /ecommerce/${Environment}/delivery-pricing/api/arn
Type: String
Value: !Sub "arn:${AWS::Partition}:execute-api:${AWS::Region}:${AWS::AccountId}:${Api}/prod"
ApiUrlParameter:
Type: AWS::SSM::Parameter
Properties:
Name: !Sub /ecommerce/${Environment}/delivery-pricing/api/url
Type: String
Value: !Sub "https://${Api}.execute-api.${AWS::Region}.amazonaws.com/prod"
ApiDomainParameter:
Type: AWS::SSM::Parameter
Properties:
Name: !Sub /ecommerce/${Environment}/delivery-pricing/api/domain
Type: String
Value: !Sub "${Api}.execute-api.${AWS::Region}.amazonaws.com"