Skip to content

Instantly share code, notes, and snippets.

@gabcoyne
Created March 9, 2022 21:04
Show Gist options
  • Save gabcoyne/7027812e5f13142bec4c5f5e4143d76c to your computer and use it in GitHub Desktop.
Save gabcoyne/7027812e5f13142bec4c5f5e4143d76c to your computer and use it in GitHub Desktop.
Event Driven Prefect serverless.yml
service: flow-starter-lambda
frameworkVersion: "3"
provider:
name: aws
runtime: python3.8
lambdaHashingVersion: 20201221
iamRoleStatements:
- Effect: Allow
Action:
- ssm:GetParameter
Resource:
Fn::Join:
- ""
- - "arn:aws:ssm:"
- Ref: AWS::Region
- ":"
- Ref: AWS::AccountId
- ":parameter/*"
- Effect: "Allow"
Action:
- "*"
Resource:
- arn:aws:s3:::${self:custom.messageBucket}/*
- arn:aws:s3:::${self:custom.messageBucket}
functions:
flow-starter:
handler: handler.run
layers:
- { Ref: PythonRequirementsLambdaLayer }
events:
- s3:
bucket: ${self:custom.messageBucket}
event: s3:ObjectCreated:*
rules:
- prefix: raw_files/
- suffix: .json
environment:
STAGE: ${opt:stage, 'dev'}
PREFECT_API_URL: https://api.prefect.io/graphql
PREFECT_VERSION_GROUP_ID: 1bd38827-3c57-417b-b310-a9fe34083b6a
plugins:
- serverless-python-requirements
custom:
pythonRequirements:
dockerizePip: non-linux
layer: true
messageBucket: a-bucket.${opt:stage, 'dev'}.prefect.io
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment