feat: Add aws-ruby-step-functions-with-callback example
#640
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Big picture behind
Currently, there aren't many examples of using the serverless approach with Ruby for AWS. Ruby is a great and mature language with a great community and lots of gems.
General message
There are not many examples of Step Functions, and especially with the Callback pattern.
Luckily we also now have Workflow Studio for AWS Step Functions, so it's easier to design state machines.
This is an example of using
AWS Step Functionswith a callback pattern. It usesAWS Lambda,DynamoDB,API Gateway,Amazon Comprehend, flows from Step Functions.his Workflow is quite simple. Assuming we have a comment system in our application, we would like to check for PII data before adding the comment to the database.
To do this, we use
Amazon Comprehendwhich, based on trained ML models, checks if a given unstructured text contains sensitive data and returns information on which positions in the sentence it is located.When detecting sensitive data with
Amazon Comprehend, we use thetaskTokenfrom AWS step functions to wait for the detection results and continue our workflow.Keep in mind, that taskToken is generated by Step Functions automatically.
Then, depending on the detection results, we perform a redaction process, replacing the sensitive data with an asterisk (*)
At the very end, the redacted comment is saved into the database (DynamoDB)
Diagrams could be found here:



Extra points: