-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtemplate.yaml
More file actions
57 lines (53 loc) · 1.94 KB
/
template.yaml
File metadata and controls
57 lines (53 loc) · 1.94 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
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: >
PDF Converter Service
Serverless PDF to image conversion service with JWT authentication
# More info about Globals: https://github.com/awslabs/serverless-application-model/blob/master/docs/globals.rst
Globals:
Function:
Timeout: 60
MemorySize: 2048
Resources:
PdfConverterFunction:
Type: AWS::Serverless::Function
Properties:
PackageType: Image
Architectures:
- x86_64
Environment:
Variables:
JWT_SECRET_NAME: pdf-converter/jwt-secret
CONVERSION_DPI: '300'
PNG_COMPRESSION: '6'
MAX_PAGES: '500'
VIPS_WARNING: '0'
Policies:
- Statement:
- Effect: Allow
Action:
- secretsmanager:GetSecretValue
Resource: !Sub 'arn:aws:secretsmanager:${AWS::Region}:${AWS::AccountId}:secret:pdf-converter/jwt-secret*'
Events:
ConvertPdf:
Type: Api
Properties:
Path: /convert
Method: post
Metadata:
DockerTag: ruby3.4-v1
DockerContext: ./pdf_converter
Dockerfile: Dockerfile
Outputs:
# ServerlessRestApi is an implicit API created out of Events key under Serverless::Function
# Find out more about other implicit resources you can reference within SAM
# https://github.com/awslabs/serverless-application-model/blob/master/docs/internals/generated_resources.rst#api
PdfConverterApi:
Description: "API Gateway endpoint URL for Prod stage for PDF Converter function"
Value: !Sub "https://${ServerlessRestApi}.execute-api.${AWS::Region}.${AWS::URLSuffix}/Prod/convert/"
PdfConverterFunction:
Description: "PDF Converter Lambda Function ARN"
Value: !GetAtt PdfConverterFunction.Arn
PdfConverterFunctionIamRole:
Description: "Implicit IAM Role created for PDF Converter function"
Value: !GetAtt PdfConverterFunctionRole.Arn