Created
April 5, 2020 17:41
-
-
Save fideliocc/867ca4af97aa4bc406795955be6803a2 to your computer and use it in GitHub Desktop.
PDF Generator Serverless Template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
service: pdf-service | |
plugins: | |
- serverless-apigw-binary | |
package: | |
exclude: | |
- pdf_generation/** | |
layers: | |
pdfGeneration: | |
path: pdf_generation | |
provider: | |
name: aws | |
runtime: nodejs10.x | |
profile: <your-profile> | |
stage: ${opt:stage, 'dev'} # use --stage flag in deploy | |
region: ${self:custom.secrets.${self:provider.stage}.REGION} | |
environment: | |
REGION: ${self:custom.secrets.${self:provider.stage}.REGION} | |
NODE_PATH: "./:/opt/node_modules" | |
iamRoleStatements: | |
- Effect: 'Allow' | |
Action: | |
- "s3:ListObject" | |
- "s3:PutObject" | |
- "s3:GetObject" | |
Resource: "*" | |
functions: | |
reports: | |
handler: reports.handler | |
timeout: 16 | |
memorySize: 1024 | |
events: | |
- http: | |
path: /reports | |
method: get | |
cors: true | |
# You can also receive the event from another component as an event | |
# - sns: | |
# arn: ${self:custom.secrets.${self:provider.stage}.EVENTMETRICSTOPDFGENERATOR} | |
layers: | |
- { Ref: PdfGenerationLambdaLayer } | |
resources: | |
Resources: | |
pdfStore: | |
Type: AWS::S3::Bucket | |
Properties: | |
BucketName: pdf-store | |
custom: | |
secrets: ${file(./secrets.json)} | |
apigwBinary: | |
types: | |
- 'image/jpeg' | |
- 'text/html' | |
- 'application/pdf' | |
- 'multipart/form-data' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment