forked from zahaar/generate-pdf-lambda
-
Notifications
You must be signed in to change notification settings - Fork 0
/
template.yaml
60 lines (56 loc) · 1.57 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
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Globals:
Api:
BinaryMediaTypes:
- application~1pdf
Resources:
# Define an API GateWay
ApiGatewayApi:
Type: AWS::Serverless::Api
Properties:
StageName: Prod
Auth:
ApiKeyRequired: true
UsagePlan:
CreateUsagePlan: PER_API
UsagePlanName: GatewayAuthorization
BinaryMediaTypes:
- application~1pdf
# BinaryMediaTypes:
# - '*~1*'
# DefinitionBody:
# x-amazon-apigateway-binary-media-types:
# - '*/*'
# Define the consumer Lambda function and EventBridge rule
PdfFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: src/
Handler: app.handler
Runtime: nodejs12.x
Timeout: 15
MemorySize: 3008
Layers:
- !Sub 'arn:aws:lambda:${AWS::Region}:764866452798:layer:chrome-aws-lambda:22'
# Environment:
# Variables:
# EXAMPLE_ENV: 'CHANGE_THIS'
Events:
ApiEvent:
Type: Api
Properties:
Path: /pdf
Method: post
Auth:
ApiKeyRequired: true
RestApiId:
Ref: ApiGatewayApi
Outputs:
ApiGatewayApi:
Description: "The URL is:"
Value:
Fn::Sub: https://${ApiGatewayApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/
ApiKey:
Description: "You can find your API Key in the AWS console: (Put in the request HEADER as 'x-api-key')"
Value: !Sub "https://console.aws.amazon.com/apigateway/home?region=${AWS::Region}#/api-keys/"