
Turn files uploaded to Amazon S3 into structured JSON with Amazon Bedrock Data Automation and AWS Lambda, with no machine-learning code.
input/ prefix of the Amazon S3 bucket, the ObjectCreated event triggers an AWS Lambda function. The function calls the BDA runtime InvokeDataAutomationAsync API, passing the input file location, an output location, and the Amazon Bedrock Data Automation project that defines what to extract. The function is fire-and-forget: it only starts the asynchronous job and returns immediately, so it stays small and cheap.output/ prefix of the same bucket. The project in this pattern uses a standard output configuration that returns each document as Markdown text (including tables) plus a generative summary. The project also processes image, video, and audio files with service defaults; you can add Image, Video, or Audio blocks to the project resource to control the standard output for those modalities, or attach a custom output configuration (a blueprint) that defines the exact fields you want.AWS::Bedrock::DataAutomationProject), so the entire pipeline is defined as infrastructure as code and the amount of custom code is minimal. AWS Identity and Access Management (IAM) permissions follow least privilege: the AWS Lambda function role may read only the input/ prefix of the pattern bucket, write only the output/ prefix, and invoke only the Bedrock Data Automation project that the stack creates.us., eu. or apac.data-automation-v1), the IAM policy allows only that profile and the project the stack creates, and a CloudFormation Rules assertion stops the deployment early in a Region that offers none of those profiles. Because both Amazon S3 and AWS Lambda are pay-per-use and Bedrock Data Automation is fully managed, the pipeline scales to zero and has no idle cost. If the function cannot start a job for an upload, AWS Lambda retries the event twice and then sends it to an Amazon Simple Queue Service (Amazon SQS) queue, the function's on-failure destination, so the event is kept for inspection instead of discarded.git clone https://github.com/aws-samples/serverless-patterns/cd serverless-patterns/s3-bedrock-data-automation/python/samsam buildsam deploy --guidedaws s3 cp ./sample-invoice.pdf s3://$BUCKET/input/sample-invoice.pdf --region $REGION.aws s3 ls s3://$BUCKET/output/ --recursive --region $REGION. See the README for detailed instructions.aws s3 rm s3://YOUR_BUCKET --recursive --region REGION_NAME.sam delete --stack-name STACK_NAME --region REGION_NAME. Enter y at each confirmation prompt.