Skip to content

Commit 21b9165

Browse files
authored
Update README.md
1 parent b6f5be7 commit 21b9165

File tree

1 file changed

+29
-14
lines changed

1 file changed

+29
-14
lines changed

sfn-comprehend-terraform/README.md

Lines changed: 29 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# AWS Step Functions Integration with Amazon Comprehend for Sentiment Analysis
1+
# AWS Step Functions integration with Amazon Comprehend using terraform
22

33
The AWS Step Functions Express Workflow can be started using the AWS CLI or from another service (e.g. Amazon API Gateway) to run an express workflow and return the result.
44

@@ -36,7 +36,7 @@ Important: this application uses various AWS services and there are costs associ
3636
3737
## How it works
3838
39-
* Start the Express Workflow using the `start-sync-execution` api command with a "message" string in English for sentiment analysis in the input payload.
39+
* Start the Standard Workflow using the `start-execution` api command with a "message" string in English for sentiment analysis in the input payload.
4040
* The Express Workflow invokes Amazon Comprehend.
4141
* Amazon Comprehend returns the sentiment of the input text.
4242
* If the integration works fine, the sentiment analysis outcome is returned in Step Function execution results within a `output` object
@@ -49,34 +49,49 @@ Please refer to the architecture diagram below:
4949
5050
## Testing
5151
52-
Run the following AWS CLI command to send a 'start-sync-execution` comand to start the AWS Step Functions workflow. Note, you must edit the {StateMachineExpressSyncToComprehend} placeholder with the ARN of the deployed AWS Step Functions workflow. This is provided in the stack outputs.
52+
Run the following AWS CLI command to send a 'start-execution' command to start the AWS Step Functions workflow. Note, you must edit the <StateMachineArn> placeholder with the ARN of the deployed AWS Step Functions workflow. This is provided in the stack outputs.
5353
5454
```bash
55-
aws stepfunctions start-sync-execution --name "test" --state-machine-arn "{StateMachineExpressSyncToComprehend}" --input "{\"message\":\"I am very happy today.\"}"
55+
aws stepfunctions start-execution \
56+
--state-machine-arn <StateMachineArn> \
57+
--input '{"message":"I am very happy today."}'
58+
```
59+
60+
After running the above command, the exection ARN will be displayed as follows -
61+
```bash
62+
{
63+
"executionArn": "arn:aws:states:us-east-1:<AccountId>:execution:StateMachineExpressSyncToComprehend:4d309af8-fb35-4427-aefc-da035954ccc3",
64+
"startDate": "2025-10-15T16:29:41.454000+02:00"
65+
}
66+
```
67+
68+
Run the describe-execution command to view the output from StepFunctions execution
69+
70+
```bash
71+
aws stepfunctions describe-execution --execution-arn arn:aws:states:us-east-1:<AccountId>:execution:StateMachineExpressSyncToComprehend:4d309af8-fb35-4427-aefc-da035954ccc3
5672
```
5773

5874
### Example output:
5975

6076
```bash
6177
{
62-
"executionArn": "arn:aws:states:us-east-1:<AccountNumber>:express:StateMachineExpressSyncToComprehend-cqmUxRLjlvq7:test:8b75495d-cb96-4933-ac25-1f908050e33d",
63-
"stateMachineArn": "arn:aws:states:us-east-1:<AccountNumber>:stateMachine:StateMachineExpressSyncToComprehend-cqmUxRLjlvq7",
64-
"name": "test",
65-
"startDate": "2023-10-08T07:35:55.257000+05:30",
66-
"stopDate": "2023-10-08T07:35:55.358000+05:30",
78+
"executionArn": "arn:aws:states:us-east-1:204524526462:execution:StateMachineExpressSyncToComprehend:4d309af8-fb35-4427-aefc-da035954ccc3",
79+
"stateMachineArn": "arn:aws:states:us-east-1:204524526462:stateMachine:StateMachineExpressSyncToComprehend",
80+
"name": "4d309af8-fb35-4427-aefc-da035954ccc3",
6781
"status": "SUCCEEDED",
82+
"startDate": "2025-10-15T16:29:41.454000+02:00",
83+
"stopDate": "2025-10-15T16:29:41.724000+02:00",
6884
"input": "{\"message\":\"I am very happy today.\"}",
6985
"inputDetails": {
7086
"included": true
7187
},
72-
"output": "{\"message\":\"I am very happy today.\",\"Sentiment\":{\"Sentiment\":\"POSITIVE\",\"SentimentScore\":{\"Mixed\":1.4907288E-4,\"Negative\":1.3237515E-4,\"Neutral\":3.8026855E-4,\"Positive\":0.9993383}}}",
88+
"output": "{\"message\":\"I am very happy today.\",\"Sentiment\":{\"Sentiment\":\"POSITIVE\",\"SentimentScore\":{\"Mixed\":6.753839E-4,\"Negative\":5.647173E-4,\"Neutral\":0.0011139456,\"Positive\":0.99764603}}}",
7389
"outputDetails": {
7490
"included": true
7591
},
76-
"billingDetails": {
77-
"billedMemoryUsedInMB": 64,
78-
"billedDurationInMilliseconds": 200
79-
}
92+
"redriveCount": 0,
93+
"redriveStatus": "NOT_REDRIVABLE",
94+
"redriveStatusReason": "Execution is SUCCEEDED and cannot be redriven"
8095
}
8196
```
8297
## Cleanup

0 commit comments

Comments
 (0)