[{"data":1,"prerenderedAt":84},["ShallowReactive",2],{"workflow-bedrock-batch-with-sla":3},{"id":4,"title":5,"cleanup":6,"contributors":10,"deploy":12,"description":17,"diagram":18,"extension":19,"framework":20,"gitHub":21,"introBox":30,"level":35,"meta":36,"resources":38,"s3URL":65,"services":66,"simplicity":75,"stem":76,"testing":77,"type":81,"usecase":82,"videoId":29,"__hash__":83},"workflows\u002Fworkflows\u002Fbedrock-batch-with-sla.json","Amazon Bedrock Batch Inference with On-Demand SLA Fallback",{"headline":7,"text":8},"Cleanup",[9],"Delete the stack: \u003Ccode>cdk destroy\u003C\u002Fcode>.",[11],"content\u002Fcontributors\u002Fsubha-venugopal.json",{"text":13},[14,15,16],"npm install","cdk bootstrap aws:\u002F\u002F\u003CACCOUNT_ID>\u002F\u003CREGION>","cdk deploy -c modelId=us.anthropic.claude-sonnet-4-6 -c slaTotalMinutes=360","Runs Amazon Bedrock batch inference as the primary cost-effective path, with automatic fallback to on-demand inference using a Distributed Map when the SLA deadline is at risk. Uses the callback (task token) pattern to suspend execution cheaply while waiting for the batch job, and the saga pattern to ensure a clean terminal state on any failure.","\u002Fassets\u002Fimages\u002Fworkflows\u002Fbedrock-batch-with-sla.png","json","AWS CDK",{"template":22,"payloads":27},{"repoURL":23,"templateDir":24,"templateFile":25,"ASL":26},"https:\u002F\u002Fgithub.com\u002Faws-samples\u002Fstep-functions-workflows-collection\u002Ftree\u002Fmain\u002Fbedrock-batch-with-sla\u002F","bedrock-batch-with-sla","stack.py","statemachine\u002Fstatemachine.asl.json",[28],{"headline":29,"payloadURL":29},"",{"headline":31,"text":32},"How it works",[33,34],"An Amazon S3 upload triggers a Registrar AWS Lambda function that starts the AWS Step Functions execution. The workflow submits an Amazon Bedrock batch inference job, records the job ARN in Amazon DynamoDB, then suspends using the callback (task token) pattern — consuming no compute while waiting.","The execution resumes through one of three triggers: the batch job completing (Amazon EventBridge), a stuck-job Amazon CloudWatch alarm (Amazon SNS → Lambda function), or an AWS Step Functions timeout. All three converge on the same fallback path: stop the batch job, reconcile which records were not yet processed, redrive them through a Distributed Map using on-demand Bedrock InvokeModel calls, and merge the results into a single output file.","300",{"language":37},"Python",{"headline":39,"bullets":40},"Additional resources",[41,44,47,50,53,56,59,62],{"text":42,"link":43},"Bedrock Batch Inference docs","https:\u002F\u002Fdocs.aws.amazon.com\u002Fbedrock\u002Flatest\u002Fuserguide\u002Fbatch-inference.html",{"text":45,"link":46},"Step Functions Callback Pattern (waitForTaskToken)","https:\u002F\u002Fdocs.aws.amazon.com\u002Fstep-functions\u002Flatest\u002Fdg\u002Fconnect-to-resource.html",{"text":48,"link":49},"Step Functions Distributed Map","https:\u002F\u002Fdocs.aws.amazon.com\u002Fstep-functions\u002Flatest\u002Fdg\u002Fconcepts-asl-use-map-state-distributed.html",{"text":51,"link":52},"JSONL support for Distributed Map ItemReader","https:\u002F\u002Faws.amazon.com\u002Fblogs\u002Fcompute\u002Fintroducing-jsonl-support-with-step-functions-distributed-map\u002F",{"text":54,"link":55},"Monitor Bedrock Batch Inference with CloudWatch","https:\u002F\u002Faws.amazon.com\u002Fblogs\u002Fmachine-learning\u002Fmonitor-amazon-bedrock-batch-inference-using-amazon-cloudwatch-metrics\u002F",{"text":57,"link":58},"EventBridge for Bedrock job state changes","https:\u002F\u002Fdocs.aws.amazon.com\u002Fbedrock\u002Flatest\u002Fuserguide\u002Fmonitoring-eventbridge.html",{"text":60,"link":61},"Saga Pattern on AWS","https:\u002F\u002Fdocs.aws.amazon.com\u002Fprescriptive-guidance\u002Flatest\u002Fcloud-design-patterns\u002Fsaga-patterns.html",{"text":63,"link":64},"Cost optimization with Bedrock Batch Inference","https:\u002F\u002Faws.amazon.com\u002Fblogs\u002Fmachine-learning\u002Feffective-cost-optimization-strategies-for-amazon-bedrock\u002F",null,[67,68,69,70,71,72,73,74],"bedrock","sfn","lambda","s3","dynamodb","cloudwatch","sns","eventbridge","3 - Application","workflows\u002Fbedrock-batch-with-sla",{"headline":78,"text":79},"Testing",[80],"See the GitHub repo for detailed testing instructions.","Standard","Machine Learning","k5jxQ12NZxZzDaTCIN3NKeGXO71coZThtPGdV1iGFXY",1785062136866]