This is an example implementation of building a StepFunctions state machine that translates text using some AWS SDK integration.
- For placing objects resulting from translation.
- For storing the execution logs of the StepFunctions state machine.
- State machine that translates a text.
- Use following AWS SDK integration:
- Translate: translateText
- S3: putObject
sequenceDiagram
participant c as Client
participant sm as Step Functions StateMachine
participant init as Init State
participant translate as Translate State
participant sdk as Amazon Translate SDK
participant output as Output State
participant s3 as S3 Bucket
c ->> sm: Start Execution
Note left of sm: {<br> "sourceLang":"en",<br> "targetLang":"ja",<br> "inputText":"Hello"<br>}
sm ->> init: props
init ->> translate: props
translate ->> sdk: translate:TranslateText
sdk ->> translate: result
translate ->> output: translate result
output ->> s3: s3:PutObject
c ->> s3: GetObject
s3 ->> c: こんにちは
export OUTPUT_BUCKET_NAME='output-bucket-name'
go test .
cdk synth
cdk deploy
aws stepfunctions start-execution \
--state-machine-arn $(
aws stepfunctions list-state-machines \
--query "stateMachines[?name=='sdk-integration-example-state-machine'].stateMachineArn" \
--output text) \
--input file://testdata/statemachine_input.json
Check result.
aws s3 cp "s3://${OUTPUT_BUCKET_NAME}/translate-result" -
# "こんにちは。これは、Go 言語で AWS CDK を使用するための実装例です。"