Refactoring to ServerlessReplace Lambda with Service Integration2 min
Description
As part of your AWS Step Functions workflow, if you want to integrate with other AWS Services like Amazon Rekognition to detect object in an image, run and wait for AWS Batch job, or run an Amazon Elastic Container Service (Amazon ECS) task and wait for it to complete, you had to write a custom AWS Lambda function to handle each step of that service integration.
An example of custom Lambda making Rekognition call might look as follows:
Use Step Functions' SDK Service Integration to directly call each AWS Service's API directly from your worklow.
See the CDK implementation of this pattern in Typescript on GitHub.
Considerations
Advantages
You eliminate a run-time element (AWS Lambda) and thus reduce cost and run-time complexity.
You reduce a little latency by eliminating the extra service hop.
Limitation
You might lose the ability to decouple the API syntax from Step Functions, e.g. by setting defaults or post-processing results in the Lambda function.
Applicability
Service Integration can invoke almost all AWS SDK APIs. See the documentation for limitations
Cost: If you can replace the Lambda invocation with a single Step Functions state, the Step Functions cost remains but you save the Lambda execution cost. if you require an additional step, e.g. a pass state, standard workflows cost $0.025 per 1,000 state transitions, or roughly 1.5 Lambda GB-second. Express Workflow pricing matches Lambda pricing per GB-sec [validate]
Gregor HohpeI contemplate and write about architecture strategy, cloud, and IT transformation. In between I - extract order from chaos - dive into the engine room to give the penthouse better IT strategies - fight relentlessly against unnecessary complexity and corporate politics I've been called the ''IT transformation jester'' - unbiased, trusted, influential, and witty.
Sindhu PillaiAs Regional SA Lead, I focus on enterprise Education Technology customers. In my role, I guide my SA team in the delivery and execution of complex technical solutions to support our customer's business and technical goals.