Skip to content
GitHubXDiscordRSS

Flow

Learn how to create, update, and manage AWS Bedrock Flows using Alchemy Cloud Control.

The Flow resource allows you to create and manage AWS Bedrock Flows which are essential for orchestrating AI model interactions and deployments.

Create a basic Flow with required properties and one optional tag.

import AWS from "alchemy/aws/control";
const basicFlow = await AWS.Bedrock.Flow("basicFlow", {
executionRoleArn: "arn:aws:iam::123456789012:role/BedrockExecutionRole",
name: "BasicFlow",
tags: {
project: "AIModelIntegration"
}
});

Configure a Flow with a detailed definition and custom encryption key.

import AWS from "alchemy/aws/control";
const advancedFlow = await AWS.Bedrock.Flow("advancedFlow", {
executionRoleArn: "arn:aws:iam::123456789012:role/BedrockExecutionRole",
name: "AdvancedFlow",
definitionString: JSON.stringify({
version: "1.0",
states: {
StartState: {
Type: "Task",
Resource: "arn:aws:bedrock:us-west-2:123456789012:framework/my-framework",
End: true
}
}
}),
customerEncryptionKeyArn: "arn:aws:kms:us-west-2:123456789012:key/abcdefgh-ijkl-mnop-qrst-uvwxyz123456"
});

Create a Flow that includes definition substitutions for dynamic values.

import AWS from "alchemy/aws/control";
const flowWithSubstitutions = await AWS.Bedrock.Flow("flowWithSubstitutions", {
executionRoleArn: "arn:aws:iam::123456789012:role/BedrockExecutionRole",
name: "FlowWithSubstitutions",
definition: {
version: "1.0",
states: {
InitialState: {
Type: "Pass",
Result: "Hello, {name}!",
Next: "FinalState"
},
FinalState: {
Type: "Succeed"
}
}
},
definitionSubstitutions: {
name: "World"
}
});

Configure a Flow that pulls its definition from an S3 bucket.

import AWS from "alchemy/aws/control";
const flowWithS3Location = await AWS.Bedrock.Flow("flowWithS3Location", {
executionRoleArn: "arn:aws:iam::123456789012:role/BedrockExecutionRole",
name: "FlowWithS3",
definitionS3Location: {
bucket: "my-bucket",
key: "path/to/flow-definition.json"
}
});