Skip to content

New pattern - Step Functions to Bedrock InvokeModel (CDK)#3083

Open
NithinChandranR-AWS wants to merge 1 commit into
aws-samples:mainfrom
NithinChandranR-AWS:NithinChandranR-AWS-feature-sfn-bedrock-invokemodel-cdk
Open

New pattern - Step Functions to Bedrock InvokeModel (CDK)#3083
NithinChandranR-AWS wants to merge 1 commit into
aws-samples:mainfrom
NithinChandranR-AWS:NithinChandranR-AWS-feature-sfn-bedrock-invokemodel-cdk

Conversation

@NithinChandranR-AWS
Copy link
Copy Markdown
Contributor

Description

This pattern deploys a Step Functions Express workflow that invokes Amazon Bedrock (Claude Sonnet) directly using the native InvokeModel optimized integration — no Lambda function required. Deployed with AWS CDK.

Key Features

  • No Lambda — Step Functions calls Bedrock directly via BedrockInvokeModel L2 CDK construct
  • Express workflow for synchronous sub-5-minute executions
  • resultSelector extracts response text, model, and usage metadata
  • Built-in retry with exponential backoff (3 attempts, 20s base interval)
  • Inference profile ARN via ProvisionedModel.fromProvisionedModelArn (required for cross-region inference profiles)

Architecture

Step Functions (Express) ──▶ Amazon Bedrock (Claude Sonnet)

Testing

Deployed and tested on AWS account. Verified:

  • SUCCEEDED execution status
  • Successful Bedrock Claude Sonnet response with usage metadata
  • Fixed: FoundationModel.fromFoundationModelId generates foundation-model ARN but inference profiles need inference-profile ARN — used ProvisionedModel.fromProvisionedModelArn with constructed ARN

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation (README.md)
  • My changes generate no new warnings
  • New and existing tests pass locally with my changes
  • example-pattern.json included

Step Functions Express workflow that invokes Amazon Bedrock Claude
Sonnet directly using the native InvokeModel optimized integration.
No Lambda function required — reduces latency, cost, and complexity.

- BedrockInvokeModel L2 CDK construct with resultSelector
- Express workflow for synchronous sub-5-minute executions
- Built-in retry with exponential backoff (3 attempts, 20s base)
- Scoped IAM for inference profile + foundation model ARNs
@NithinChandranR-AWS
Copy link
Copy Markdown
Contributor Author

Hi @biswanathmukherjee 👋 Friendly nudge — this pattern is ready for review. Deployed and tested end-to-end on a live AWS account. Would appreciate a look when you have time. Thank you!

@NithinChandranR-AWS
Copy link
Copy Markdown
Contributor Author

Hi @biswanathmukherjee 👋 This shows Step Functions native BedrockInvokeModel — direct SFN→Bedrock without Lambda. Uses the L2 BedrockInvokeModel construct. Different from Lambda+Bedrock patterns — zero Lambda involved.


---

Copyright 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Copyright 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved.
Copyright 2026 Amazon.com, Inc. or its affiliates. All Rights Reserved.

@@ -0,0 +1,83 @@
# Step Functions to Amazon Bedrock InvokeModel (CDK)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Step Functions to Amazon Bedrock InvokeModel (CDK)
# AWS Step Functions Express workflow with optimized integration for Amazon Bedrock InvokeModel

- [Create an AWS account](https://portal.aws.amazon.com/gp/aws/developer/registration/index.html) if you do not already have one and log in. The IAM user that you use must have sufficient permissions to make necessary AWS service calls and manage AWS resources.
- [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2.html) installed and configured
- [AWS CDK](https://docs.aws.amazon.com/cdk/latest/guide/cli.html) installed
- [Node.js](https://nodejs.org/) 18.x or later
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nodejs 18.x is EOL

- [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2.html) installed and configured
- [AWS CDK](https://docs.aws.amazon.com/cdk/latest/guide/cli.html) installed
- [Node.js](https://nodejs.org/) 18.x or later
- [Amazon Bedrock model access](https://docs.aws.amazon.com/bedrock/latest/userguide/model-access.html) enabled for Anthropic Claude Sonnet in your AWS account
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- [Amazon Bedrock model access](https://docs.aws.amazon.com/bedrock/latest/userguide/model-access.html) enabled for Anthropic Claude Sonnet in your AWS account
- [Amazon Bedrock model access](https://docs.aws.amazon.com/bedrock/latest/userguide/model-access.html) enabled for a model of your choice (Anthropic Claude Sonnet is the default in this pattern) in your AWS account


## How it works

Step Functions has a native optimized integration with Amazon Bedrock that lets you call `bedrock:InvokeModel` directly from a workflow state — no Lambda function needed. This reduces latency, cost, and operational complexity.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't need a Lambda function for any Step Functions integration, the benefits of an optimized integration are more than that

@@ -0,0 +1,52 @@
{
"title": "Step Functions to Amazon Bedrock InvokeModel",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"title": "Step Functions to Amazon Bedrock InvokeModel",
"title": "AWS Step Functions Express integration with Amazon Bedrock InvokeModel",

@@ -0,0 +1,52 @@
{
"title": "Step Functions to Amazon Bedrock InvokeModel",
"description": "Invoke Amazon Bedrock directly from Step Functions using the native InvokeModel optimized integration — no Lambda function required. Deployed with AWS CDK.",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"description": "Invoke Amazon Bedrock directly from Step Functions using the native InvokeModel optimized integration — no Lambda function required. Deployed with AWS CDK.",
"description": "Invoke Amazon Bedrock directly from Step Functions using the native InvokeModel optimized integration. Deployed with AWS CDK.",

"headline": "How it works",
"text": [
"This pattern deploys a Step Functions Express workflow that invokes Amazon Bedrock (Claude Sonnet) directly using the native bedrock:InvokeModel optimized integration.",
"No Lambda function is needed — Step Functions calls Bedrock directly, reducing latency, cost, and operational complexity.",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see comment on the README regarding optimized integrations

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants