Skip to content

Commit d77fffe

Browse files
committed
stepfunctions-bedrock-sam: Update ModelId to Claude Sonnet 4.5
1 parent 316e2d5 commit d77fffe

File tree

5 files changed

+28
-15
lines changed

5 files changed

+28
-15
lines changed

stepfunctions-bedrock-sam/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# AWS Step Functions Express Workflow to Amazon Bedrock Anthropic Claude Model v2.1 for Content Generation
1+
# AWS Step Functions Express Workflow to Amazon Bedrock Anthropic Claude Sonnet 4.5 for Content Generation
22

33
The Step Functions Express Workflow can be started using the AWS CLI or from another service (e.g. API Gateway).
44

5-
The SAM template deploys a Step Functions Express workflow that invokes Amazon Bedrock Anthropic Claude Model v2.1 and returns the generated content based on the provided prompts. The SAM template contains the required resources with IAM permission to run the application with logging enabled.
5+
The SAM template deploys a Step Functions Express workflow that invokes Amazon Bedrock Anthropic Claude Sonnet 4.5 and returns the generated content based on the provided prompts. The SAM template contains the required resources with IAM permission to run the application with logging enabled.
66

77
Learn more about this pattern at Serverless Land Patterns: https://serverlessland.com/patterns/stepfunctions-bedrock-sam
88

@@ -42,7 +42,7 @@ Important: this application uses various AWS services and there are costs associ
4242
## How it works
4343
4444
* Start the Express Workflow using the `start-sync-execution` api command with a "prompt" string in English for generating content as per the input payload.
45-
* The Express Workflow invokes Amazon Bedrock Anthropic Claude v2.1 Model with the prompt.
45+
* The Express Workflow invokes Amazon Bedrock Anthropic Claude Sonnet 4.5 with the prompt.
4646
* Amazon Bedrock returns the generated content as the given promptsentiment of the input text.
4747
* If the integration succeeds, the generated content is returned in the Step Function execution results within an `output` object.
4848
* If the integration fails, the Step Functions workflow will retry up to 5 times before exiting with a `status:FAILED` response.

stepfunctions-bedrock-sam/example-pattern.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
{
22
"title": "AWS Step Functions to Amazon Bedrock Integration",
3-
"description": "The SAM template deploys a Step Functions workflow that invokes Amazon Bedrock Anthropic Claude Model v2.1 to generate content for a given prompt.",
3+
"description": "The SAM template deploys a Step Functions workflow that invokes Amazon Bedrock Anthropic Claude Sonnet 4.5 to generate content for a given prompt.",
44
"language": "YAML",
55
"level": "200",
66
"framework": "AWS SAM",
77
"introBox": {
88
"headline": "How it works",
99
"text": [
1010
"Start the Express Workflow using the `start-sync-execution` api command with a prompt string in English for generating content as per the input payload.",
11-
"The Express Workflow invokes Amazon Bedrock Anthropic Claude v2.1 Model with the prompt.",
11+
"The Express Workflow invokes Amazon Bedrock Anthropic Claude Sonnet 4.5 with the prompt.",
1212
"Amazon Bedrock returns the generated content as the given promptsentiment of the input text.",
1313
"If the integration works fine, the generated content is returned in Step Function execution results within a output object.",
1414
"If the integration fails, the Step Functions workflow will retry up to 5 times before exiting with a status:FAILED response."

stepfunctions-bedrock-sam/sfn-bedrock-sam.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
{
22
"title": "AWS Step Functions to Amazon Bedrock Integration",
3-
"description": "This SAM template deploys a Step Functions workflow that invokes Amazon Bedrock Anthropic Claude Model v2.1 to generate content for a given prompt.",
3+
"description": "This SAM template deploys a Step Functions workflow that invokes Amazon Bedrock Anthropic Claude Sonnet 4.5 to generate content for a given prompt.",
44
"language": "YAML",
55
"level": "200",
66
"framework": "AWS SAM",
77
"introBox": {
88
"headline": "How it works",
99
"text": [
1010
"Start the Express Workflow using the `start-sync-execution` api command with a prompt string in English for generating content as per the input payload.",
11-
"The Express Workflow invokes Amazon Bedrock Anthropic Claude v2.1 Model with the prompt.",
11+
"The Express Workflow invokes Amazon Bedrock Anthropic Claude Sonnet 4.5 with the prompt.",
1212
"Amazon Bedrock returns the generated content as the given promptsentiment of the input text.",
1313
"If the integration succeeds, the generated content is returned in Step Function execution results within an output object.",
1414
"If the integration fails, the Step Functions workflow will retry up to 5 times before exiting with a status:FAILED response."

stepfunctions-bedrock-sam/statemachine/bedrock-integration.asl.json

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"Comment": "This state machine demonstrates the integration with Amazon Bedrock Anthropic Claude v2.1 Model",
2+
"Comment": "This state machine demonstrates the integration with Amazon Bedrock Anthropic Claude Sonnet 4.5",
33
"StartAt": "Bedrock InvokeModel",
44
"States": {
55
"Bedrock InvokeModel": {
@@ -8,8 +8,19 @@
88
"Parameters": {
99
"ModelId": "${ModelId}",
1010
"Body": {
11-
"prompt.$": "$.prompt",
12-
"max_tokens_to_sample": 200
11+
"anthropic_version": "bedrock-2023-05-31",
12+
"messages": [
13+
{
14+
"role": "user",
15+
"content": [
16+
{
17+
"type": "text",
18+
"text.$": "$.prompt"
19+
}
20+
]
21+
}
22+
],
23+
"max_tokens": 200
1324
}
1425
},
1526
"Retry": [
@@ -25,4 +36,4 @@
2536
"End": true
2637
}
2738
}
28-
}
39+
}

stepfunctions-bedrock-sam/template.yaml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Resources:
1414
Properties:
1515
DefinitionUri: statemachine/bedrock-integration.asl.json
1616
DefinitionSubstitutions:
17-
ModelId: !Sub arn:aws:bedrock:${AWS::Region}::foundation-model/anthropic.claude-v2:1
17+
ModelId: !Sub arn:aws:bedrock:${AWS::Region}:${AWS::AccountId}:inference-profile/global.anthropic.claude-sonnet-4-5-20250929-v1:0
1818
Role:
1919
Fn::GetAtt: [ StatesExecutionRole, Arn ]
2020
Type: EXPRESS
@@ -32,7 +32,7 @@ Resources:
3232
Type: AWS::Logs::LogGroup
3333
Properties:
3434
LogGroupName: !Join [ "/", [ "stepfunctions", StateMachineExpressSyncToBedrock]]
35-
35+
3636
##########################################################################
3737
# Roles #
3838
##########################################################################
@@ -72,8 +72,10 @@ Resources:
7272
Statement:
7373
- Effect: Allow
7474
Action:
75-
- "bedrock:InvokeModel"
76-
Resource: !Sub arn:aws:bedrock:${AWS::Region}::foundation-model/anthropic.claude-v2:1
75+
- "bedrock:InvokeModel*"
76+
Resource:
77+
- !Sub arn:aws:bedrock:*:*:inference-profile/global.anthropic.claude-sonnet-4-5-20250929-v1:0
78+
- !Sub arn:aws:bedrock:*::foundation-model/anthropic.claude-sonnet-4-5-20250929-v1:0
7779
##########################################################################
7880
# Outputs #
7981
##########################################################################

0 commit comments

Comments
 (0)