apigw-rest-stepfunctions-express-sync-bedrock-sam: Migrate from Cohere Command R to Amazon Nova 2 Lite#2864
Conversation
| "role": "CHATBOT", | ||
| "message.$": "$.result_one.result_one" | ||
| } | ||
| ] |
There was a problem hiding this comment.
note: I used chat_history format instead of ChatML format like Human: and Assistant:.
There was a problem hiding this comment.
Request and response schema of Amazon Nova 2 is here.
https://docs.aws.amazon.com/nova/latest/nova2-userguide/request-response-schema.html
| "ResultPath": "$.result_one", | ||
| "ResultSelector": { | ||
| "result_one.$": "$.Body.generations[0].text" | ||
| "result_one.$": "$.Body.text" |
There was a problem hiding this comment.
|
This is a REST API. So please change it to REST API wherever it is mentioned as HTTP API. |
|
The test execution failed in the Step Function with error: "Access denied. This Model is marked by provider as Legacy " |
biswanathmukherjee
left a comment
There was a problem hiding this comment.
Please make the suggested changes.
| - "logs:DescribeResourcePolicies" | ||
| - "logs:DescribeLogGroups" | ||
| Resource: "*" | ||
| Resource: "*" |
There was a problem hiding this comment.
Can this be made more restrictive than "*"
There was a problem hiding this comment.
Thank you!
CreateLogStream and PutLogEvents support resource-level permissions, so they could be scoped to a specific log group. However, the remaining actions do not support resource-level permissions and require Resource: "*".
https://docs.aws.amazon.com/service-authorization/latest/reference/list_amazoncloudwatchlogs.html
We could split these into separate statements, but the Step Functions logging documentation uses the same pattern with a single Resource: "*" for all CloudWatch Logs actions. I'd prefer to keep it consistent with the official example.
https://docs.aws.amazon.com/step-functions/latest/dg/cw-logs.html
| @@ -95,4 +94,4 @@ After runnning the above command, API Gateway will invoke the State machine and | |||
| ---- | |||
| Copyright 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. | |||
| "Resource": "arn:aws:states:::bedrock:invokeModel", | ||
| "Parameters": { | ||
| "ModelId": "cohere.command-text-v14", | ||
| "ModelId": "cohere.command-r-v1:0", |
There was a problem hiding this comment.
Please also update the readme file with this model id
…ST API based on review feedback
… to 2026 based on review feedback
…README to Cohere Command R based on review feedback
8924bd1 to
514cb2e
Compare
Hi @kakakakakku, |
…ine from Cohere Command R to Amazon Nova 2 Lite
…Amazon Nova 2 Lite migration
| "role": "CHATBOT", | ||
| "message.$": "$.result_one.result_one" | ||
| } | ||
| ] |
There was a problem hiding this comment.
Request and response schema of Amazon Nova 2 is here.
https://docs.aws.amazon.com/nova/latest/nova2-userguide/request-response-schema.html
| * [Git Installed](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) | ||
| * [AWS Serverless Application Model](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-install.html) (AWS SAM) installed | ||
| * [NOTE! Manage Access to Amazon Bedrock Foundation Models](https://docs.aws.amazon.com/bedrock/latest/userguide/model-access.html) at the time of writing, this example uses Amazon Bedrock foundation model cohere.command-text-v14 | ||
| * This example uses Amazon Bedrock foundation model amazon.nova-2-lite-v1:0 |
There was a problem hiding this comment.
|
@biswanathmukherjee
Thank you so much! |
|
Thanks @kakakakakku for your contribution. The pattern is approved from my side. DA will review and merge it soon! |
|
Thanks! |


Issue #, if available:
N/A
Description of changes:
Hi😀 Thanks for the useful patterns!
I noticed that cohere.command-text-v14 can no longer be used. When actually deployed, the following error occurs:Therefore, I updated the model to use Cohere Command R instead.Note
As of March 2026, Cohere text generation models (including Command R) are no longer available on Amazon Bedrock. After discussing with the maintainer @biswanathmukherjee, this PR has been updated to migrate the pattern to Amazon Nova 2 Lite so it remains functional.
Check (legacy)Check
Thank you😀
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.