-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtemplate.yaml
77 lines (72 loc) · 1.95 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
Transform: AWS::Serverless-2016-10-31
Metadata:
AWS::ServerlessRepo::Application:
Name: QRCodeGenerator
Author: Salvatore Cozzubo
ReadmeUrl: README.md
LicenseUrl: LICENSE
Labels:
- qrcode
- generator
- lambda
- node
- api
SourceCodeUrl: https://github.com/SalvoCozzubo/qr-code-generator
HomePageUrl: https://www.salvatorecozzubo.com
Description: A QRCode generator API
SemanticVersion: 1.0.0
Resources:
ApiGw:
Type: AWS::Serverless::Api
Properties:
StageName: Prod
BinaryMediaTypes:
- '*/*'
EndpointConfiguration:
Type: REGIONAL
GeneratorFn:
Type: AWS::Serverless::Function
Properties:
CodeUri: ./src/generator-fn
Handler: index.handler
Runtime: nodejs20.x
Events:
Api:
Type: Api
Properties:
RestApiId: !Ref ApiGw
Path: /
Method: get
RequestParameters:
- method.request.querystring.data:
Required: true
CFDistribution:
Type: AWS::CloudFront::Distribution
Properties:
Tags:
- Key: Project
Value: QRCodeGenerator
- Key: Name
Value: CloudFront
DistributionConfig:
HttpVersion: http2and3
Enabled: true
DefaultCacheBehavior:
TargetOriginId: ApiGateway
ViewerProtocolPolicy: https-only
ForwardedValues:
QueryString: true
Cookies:
Forward: all
Origins:
- Id: ApiGateway
DomainName: !Join ['', [!Ref ApiGw, '.execute-api.', !Ref 'AWS::Region', '.amazonaws.com']]
CustomOriginConfig:
HTTPSPort: 443
OriginProtocolPolicy: https-only
OriginSSLProtocols: [ "TLSv1", "TLSv1.1", "TLSv1.2" ]
OriginPath: "/Prod"
Outputs:
Url:
Description: CloudFront URL
Value: !GetAtt CFDistribution.DomainName