Skip to content

Commit f3dafa4

Browse files
authored
feat(stepfunctions-tasks): support for the Step Functions optimized integration for Bedrock InvokeModel API (#28276)
Step Functions recently released an optimized integration for Bedrock InvokeModel API, and these changes add support for adding the Bedrock InvokeModel task to Step Functions state machines. Closes #28268. *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent 15c7bb2 commit f3dafa4

23 files changed

+1566
-0
lines changed

packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/bedrock/integ.invoke-model.js.snapshot/InvokeModelDefaultTestDeployAssert9C0D2DFC.assets.json

+19
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/bedrock/integ.invoke-model.js.snapshot/InvokeModelDefaultTestDeployAssert9C0D2DFC.template.json

+36
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/bedrock/integ.invoke-model.js.snapshot/aws-stepfunctions-tasks-bedrock-invoke-model-integ.assets.json

+19
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
{
2+
"Resources": {
3+
"StateMachineRoleB840431D": {
4+
"Type": "AWS::IAM::Role",
5+
"Properties": {
6+
"AssumeRolePolicyDocument": {
7+
"Statement": [
8+
{
9+
"Action": "sts:AssumeRole",
10+
"Effect": "Allow",
11+
"Principal": {
12+
"Service": "states.amazonaws.com"
13+
}
14+
}
15+
],
16+
"Version": "2012-10-17"
17+
}
18+
}
19+
},
20+
"StateMachineRoleDefaultPolicyDF1E6607": {
21+
"Type": "AWS::IAM::Policy",
22+
"Properties": {
23+
"PolicyDocument": {
24+
"Statement": [
25+
{
26+
"Action": "bedrock:InvokeModel",
27+
"Effect": "Allow",
28+
"Resource": {
29+
"Fn::Join": [
30+
"",
31+
[
32+
"arn:",
33+
{
34+
"Ref": "AWS::Partition"
35+
},
36+
":bedrock:",
37+
{
38+
"Ref": "AWS::Region"
39+
},
40+
"::foundation-model/amazon.titan-text-express-v1"
41+
]
42+
]
43+
}
44+
}
45+
],
46+
"Version": "2012-10-17"
47+
},
48+
"PolicyName": "StateMachineRoleDefaultPolicyDF1E6607",
49+
"Roles": [
50+
{
51+
"Ref": "StateMachineRoleB840431D"
52+
}
53+
]
54+
}
55+
},
56+
"StateMachine2E01A3A5": {
57+
"Type": "AWS::StepFunctions::StateMachine",
58+
"Properties": {
59+
"DefinitionString": {
60+
"Fn::Join": [
61+
"",
62+
[
63+
"{\"StartAt\":\"Prompt1\",\"States\":{\"Prompt1\":{\"Next\":\"Prompt2\",\"Type\":\"Task\",\"ResultPath\":\"$\",\"ResultSelector\":{\"names.$\":\"$.Body.results[0].outputText\"},\"Resource\":\"arn:",
64+
{
65+
"Ref": "AWS::Partition"
66+
},
67+
":states:::bedrock:invokeModel\",\"Parameters\":{\"ModelId\":\"arn:",
68+
{
69+
"Ref": "AWS::Partition"
70+
},
71+
":bedrock:",
72+
{
73+
"Ref": "AWS::Region"
74+
},
75+
"::foundation-model/amazon.titan-text-express-v1\",\"Body\":{\"inputText\":\"Generate a list of five first names.\",\"textGenerationConfig\":{\"maxTokenCount\":100,\"temperature\":1}}}},\"Prompt2\":{\"End\":true,\"Type\":\"Task\",\"ResultPath\":\"$\",\"ResultSelector\":{\"names.$\":\"$.Body.results[0].outputText\"},\"Resource\":\"arn:",
76+
{
77+
"Ref": "AWS::Partition"
78+
},
79+
":states:::bedrock:invokeModel\",\"Parameters\":{\"ModelId\":\"arn:",
80+
{
81+
"Ref": "AWS::Partition"
82+
},
83+
":bedrock:",
84+
{
85+
"Ref": "AWS::Region"
86+
},
87+
"::foundation-model/amazon.titan-text-express-v1\",\"Body\":{\"inputText.$\":\"States.Format('Alphabetize this list of first names:\\n{}', $.names)\",\"textGenerationConfig\":{\"maxTokenCount\":100,\"temperature\":1}}}}},\"TimeoutSeconds\":30}"
88+
]
89+
]
90+
},
91+
"RoleArn": {
92+
"Fn::GetAtt": [
93+
"StateMachineRoleB840431D",
94+
"Arn"
95+
]
96+
}
97+
},
98+
"DependsOn": [
99+
"StateMachineRoleDefaultPolicyDF1E6607",
100+
"StateMachineRoleB840431D"
101+
],
102+
"UpdateReplacePolicy": "Delete",
103+
"DeletionPolicy": "Delete"
104+
}
105+
},
106+
"Parameters": {
107+
"BootstrapVersion": {
108+
"Type": "AWS::SSM::Parameter::Value<String>",
109+
"Default": "/cdk-bootstrap/hnb659fds/version",
110+
"Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]"
111+
}
112+
},
113+
"Rules": {
114+
"CheckBootstrapVersion": {
115+
"Assertions": [
116+
{
117+
"Assert": {
118+
"Fn::Not": [
119+
{
120+
"Fn::Contains": [
121+
[
122+
"1",
123+
"2",
124+
"3",
125+
"4",
126+
"5"
127+
],
128+
{
129+
"Ref": "BootstrapVersion"
130+
}
131+
]
132+
}
133+
]
134+
},
135+
"AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI."
136+
}
137+
]
138+
}
139+
}
140+
}

packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/bedrock/integ.invoke-model.js.snapshot/cdk.out

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/bedrock/integ.invoke-model.js.snapshot/integ.json

+12
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/bedrock/integ.invoke-model.js.snapshot/manifest.json

+125
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)