Ir para o conteúdo

AWS Lambda + S3 Trigger

Run your dotflow pipeline automatically when a file is uploaded to an S3 bucket.

Create project

dotflow init
# Select cloud: lambda-s3-trigger

Or generate files for an existing project:

dotflow cloud generate --platform lambda-s3-trigger

Generated files

File Description
Dockerfile Lambda container image
handler.py Lambda entry point
template.yaml SAM template with S3 event trigger
samconfig.toml Pre-configured deployment settings

Prerequisites

  • pip install dotflow[deploy-aws]
  • AWS CLI configured (aws configure)
  • Docker

Deploy

Option 1: dotflow deploy

dotflow deploy --platform lambda-s3-trigger --project my_pipeline

Option 2: SAM CLI

aws ecr create-repository --repository-name my_pipeline --region us-east-1
sam build
sam deploy

View logs

sam logs --stack-name my_pipeline --tail

Important

  • The SAM template creates an S3 bucket named <project_name>-source
  • The pipeline triggers on any file upload (s3:ObjectCreated:*)
  • Edit template.yaml to filter by prefix or suffix