Skip to content

Conversation

@Pigius
Copy link
Contributor

@Pigius Pigius commented Aug 14, 2021

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 Functions with a callback pattern. It uses AWS 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 Comprehend which, 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 the taskToken from 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:
step-functions-with-callback
stepfunctions-with-callback-graph
detailed-diagram-callback-sf

Extra points:

  • Used the Ruby.27 runtime, as for the Ruby2.5 will be End of Support at the end of August.

Copy link
Contributor

@pgrzesik pgrzesik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot @Pigius 🙇 I only have very minor comments, otherwise it looks great 👍

@Pigius Pigius requested a review from pgrzesik August 23, 2021 13:25
Copy link
Contributor

@pgrzesik pgrzesik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great job sir 🙌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants