Voiced by Amazon Polly |
Introduction
In moving to the cloud, several teams deploy the lift-and-shift approach, where virtual machines are set up in the cloud by moving existing workloads. Although this method brings them to the cloud, it doesn’t generally use its features for more or less than elasticity, managed services, and event-driven architectures.
In this blog, we will revolutionize the show by comparing an event-driven application around AWS Step Functions and AWS Event Bridge.
Pioneers in Cloud Consulting & Migration Services
- Reduced infrastructural costs
- Accelerated application deployment
The Problem
Orchestrating a Multi-Step Onboarding Workflow
For instance, we can outline a SaaS platform as an example. These are the steps to be taken when a new user completes the sign-up process:
Create a user record in Amazon DynamoDB. Send a welcome email via SESProvision user-specific resources (e.g., an Amazon S3 folder). Notify internal systems via Slack or a webhook.
Each implies that a different service and possibly different teams are employed with several error-handling paths. How do we design a system that is both scalable and decoupled and, in terms of observability, capable of handling these situations?
The Solution: AWS EventBridge + AWS Step Functions
Key Concepts:
- AWS EventBridge provides an event-driven, decoupled mechanism for the communication of services.
- AWS Step Functions are state machines that model workflows; they handle retries, branching, parallel execution, etc.
- Their combined usage will make the system more adaptable to changes and easier. It will also reduce the time needed to localize the fault, and it can be watched.
Step-by-Step Implementation
- Emit the Event
Your AWS Lambda function behind the/signup API only throws an event into the AWS EventBridge.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
import boto3 import json client = boto3.client('events') def lambda_handler(event, context): response = client.put_events( Entries=[ { 'Source': 'myapp.signup', 'DetailType': 'UserSignup', 'Detail': json.dumps({'user_id': '12345'}), 'EventBusName': 'default' } ] ) return {"statusCode": 200, "body": "Event sent."} |
1 2 3 4 |
{ "source": ["myapp.signup"], "detail-type": ["UserSignup"] } |
This rule invokes an AWS Step Functions state machine, forwarding the user_id.
2. Build the State Machine
And here’s the same state machine defined in a simplified JSON format:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
{ "StartAt": "CreateUser", "States": { "CreateUser": { "Type": "Task", "Resource": "arn:aws:lambda:region:acct:function:CreateUser", "Next": "SendEmail" }, "SendEmail": { "Type": "Task", "Resource": "arn:aws:lambda:region:acct:function:SendWelcomeEmail", "Next": "CreateS3Folder" }, "CreateS3Folder": { "Type": "Task", "Resource": "arn:aws:lambda:region:acct:function:CreateUserS3", "Next": "NotifySlack" }, "NotifySlack": { "Type": "Task", "Resource": "arn:aws:lambda:region:acct:function:NotifySlack", "End": true } } } |
Benefits
Decoupling
Services don’t talk to each other directly. You can add or remove consumers without changing publishers.
Observability
AWS Step Functions offers built-in monitoring and visual execution flows. Debugging becomes easier than tailing logs across services.
Resilience
AWS Step Functions manages retries and fallbacks. You can even add Catch blocks to handle failures gracefully.
Real-World Enhancements
- Security: Use AWS IAM roles with least privilege for each function.
- Auditability: Log all events in an Amazon S3 bucket or Amazon CloudWatch for compliance.
- Multi-Tenancy: Add tenant IDs in events to isolate flows per user.
Conclusion
This model decouples logic between an application and a service, offers better operational visibility, and greatly decreases failure blast radius, while remaining serverless and cost-effective. So next time you’re automating something more than a single task, think workflow, not workaround.
Drop a query if you have any questions regarding AWS Step Functions and we will get back to you quickly.
Empowering organizations to become ‘data driven’ enterprises with our Cloud experts.
- Reduced infrastructure costs
- Timely data-driven decisions
About CloudThat
CloudThat is a leading provider of Cloud Training and Consulting services with a global presence in India, the USA, Asia, Europe, and Africa. Specializing in AWS, Microsoft Azure, GCP, VMware, Databricks, and more, the company serves mid-market and enterprise clients, offering comprehensive expertise in Cloud Migration, Data Platforms, DevOps, IoT, AI/ML, and more.
CloudThat is the first Indian Company to win the prestigious Microsoft Partner 2024 Award and is recognized as a top-tier partner with AWS and Microsoft, including the prestigious ‘Think Big’ partner award from AWS and the Microsoft Superstars FY 2023 award in Asia & India. Having trained 650k+ professionals in 500+ cloud certifications and completed 300+ consulting projects globally, CloudThat is an official AWS Advanced Consulting Partner, Microsoft Gold Partner, AWS Training Partner, AWS Migration Partner, AWS Data and Analytics Partner, AWS DevOps Competency Partner, AWS GenAI Competency Partner, Amazon QuickSight Service Delivery Partner, Amazon EKS Service Delivery Partner, AWS Microsoft Workload Partners, Amazon EC2 Service Delivery Partner, Amazon ECS Service Delivery Partner, AWS Glue Service Delivery Partner, Amazon Redshift Service Delivery Partner, AWS Control Tower Service Delivery Partner, AWS WAF Service Delivery Partner, Amazon CloudFront Service Delivery Partner, Amazon OpenSearch Service Delivery Partner, AWS DMS Service Delivery Partner, AWS Systems Manager Service Delivery Partner, Amazon RDS Service Delivery Partner, AWS CloudFormation Service Delivery Partner and many more.
FAQs
1. Why do we want to use AWS EventBridge and not call AWS Step Functions directly from AWS Lambda?
ANS: – By working with Amazon EventBridge, you create a loose-coupling of your services. If you have an AWS Lambda function call AWS Step Functions directly, you establish a close dependency between them. This can be difficult to scale or migrate as your architecture grows and develops, especially for microservices-based organisations where different teams own the services.
2. Will my AWS Step Functions state fail if a step in the state fails?
ANS: – AWS Step Functions are designed for fault tolerance. If a single state (task) fails, you can specify a Retry policy, which causes the task to automatically retry itself based on error type and number of attempts.

WRITTEN BY Rajveer Singh Chouhan
Rajveer Singh Chouhan works as a Research Associate at CloudThat. He has been learning and gaining practical experience in AWS and Azure. Rajveer is also passionate about continuously expanding his skill set and knowledge base by actively seeking opportunities to learn new skills. Rajveer regularly reads blogs and articles related to various programming languages, technologies, and industry trends to stay up to date with the latest developments in the field.
Comments