<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Abdulrahman Bahri</title>
    <description>The latest articles on DEV Community by Abdulrahman Bahri (@abdulrahman_bahri).</description>
    <link>https://dev.to/abdulrahman_bahri</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3055062%2F2950c8e4-64e7-49c5-a266-346a2b2d89cb.png</url>
      <title>DEV Community: Abdulrahman Bahri</title>
      <link>https://dev.to/abdulrahman_bahri</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/abdulrahman_bahri"/>
    <language>en</language>
    <item>
      <title>SceneCraft — An Immersive Storytelling App Powered by AWS AI</title>
      <dc:creator>Abdulrahman Bahri</dc:creator>
      <pubDate>Sun, 11 May 2025 21:14:46 +0000</pubDate>
      <link>https://dev.to/abdulrahman_bahri/scenecraft-an-immersive-storytelling-app-powered-by-aws-ai-j7l</link>
      <guid>https://dev.to/abdulrahman_bahri/scenecraft-an-immersive-storytelling-app-powered-by-aws-ai-j7l</guid>
      <description>&lt;p&gt;&lt;em&gt;This is a submission for the &lt;a href="https://dev.to/challenges/aws-amazon-q-v2025-04-30"&gt;Amazon Q Developer "Quack The Code" Challenge&lt;/a&gt;: That's Entertainment!&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Built
&lt;/h2&gt;

&lt;p&gt;SceneCraft is an AI-powered storytelling experience that turns a short text prompt into a full sensory adventure. It generates a complete short story using Amazon Bedrock, breaks the story into scenes, and brings each one to life with:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Illustrations per scene (via generative image models)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Narrated voiceover using Amazon Polly&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Emotion-based background music to match each scene’s mood&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Scene-by-scene rendering in a cinematic layout&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The experience feels like a lightweight, animated audiobook — making it fun for both kids and adults. You give it just a sentence, and in return, you get an immersive, narrated story complete with visuals and sound.&lt;/p&gt;

&lt;p&gt;It’s designed to feel magical, yet it's entirely powered by AWS-native AI services.&lt;/p&gt;

&lt;h2&gt;
  
  
  Demo
&lt;/h2&gt;

&lt;p&gt;👉 &lt;a href="https://drive.google.com/file/d/1H0zNjQ8SaRXI1uy1aIOfAkVLYnRCYDPX/view?usp=sharing" rel="noopener noreferrer"&gt;Live Demo Link&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Code Repository
&lt;/h2&gt;

&lt;p&gt;🔗 &lt;a href="https://github.com/AbdulrahmanBahri/scenecraft-entertainment-app" rel="noopener noreferrer"&gt;GitHub Repository&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  How I Used Amazon Q Developer
&lt;/h2&gt;

&lt;p&gt;I used Amazon Q Developer inside the AWS Console and VS Code extension to:&lt;/p&gt;

&lt;p&gt;Scaffold AWS SDK usage quickly&lt;/p&gt;

&lt;p&gt;Generate boilerplate for Bedrock and Polly integration&lt;/p&gt;

&lt;p&gt;Debug tricky payload formats for Claude and image models&lt;/p&gt;

&lt;p&gt;Speed up Lambda function setup and S3 interactions&lt;/p&gt;

&lt;p&gt;Amazon Q helped accelerate development, especially during early exploration of the Bedrock APIs and troubleshooting parameter configurations.&lt;/p&gt;

&lt;p&gt;While this submission didn’t use Q Apps directly, it showcases what developers can build using AWS-native AI services — with Amazon Q Developer acting as the copilot behind the scenes.&lt;/p&gt;

</description>
      <category>devchallenge</category>
      <category>awschallenge</category>
      <category>ai</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Streamlining Workflows with AWS Step Functions, Lambda, and SQS</title>
      <dc:creator>Abdulrahman Bahri</dc:creator>
      <pubDate>Sat, 19 Apr 2025 10:55:57 +0000</pubDate>
      <link>https://dev.to/abdulrahman_bahri/streamlining-workflows-with-aws-step-functions-lambda-and-sqs-1nbp</link>
      <guid>https://dev.to/abdulrahman_bahri/streamlining-workflows-with-aws-step-functions-lambda-and-sqs-1nbp</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;In today’s fast-paced digital world, automating workflows can save time, reduce errors, and streamline operations. AWS provides a suite of powerful tools, including Lambda, SQS, and Step Functions, to create scalable, serverless applications that can manage complex workflows efficiently. In this article, we will walk you through how to automate a multi-step workflow using these AWS services.&lt;/p&gt;




&lt;h2&gt;
  
  
  Overview
&lt;/h2&gt;

&lt;p&gt;A quick overview of how the automation will be:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Create a standard SQS queue to handle support ticket messages.&lt;/li&gt;
&lt;li&gt;Develop Lambda functions to validate the tickets, assign tickets, and notify customers.&lt;/li&gt;
&lt;li&gt;Define a Step Functions state machine to orchestrate workflow tasks.&lt;/li&gt;
&lt;li&gt;Configure the SQS queue to trigger the Lambda function for event-driven processing.&lt;/li&gt;
&lt;li&gt;Test the workflow.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  Creating the Amazon SQS Queue
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Login to the AWS Management Console.&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Navigate to the &lt;strong&gt;Amazon SQS&lt;/strong&gt; service.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Create Queue&lt;/strong&gt; and choose &lt;strong&gt;Standard Queue&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Provide the queue name (e.g., &lt;em&gt;SupportTicketsQueue&lt;/em&gt;).&lt;/li&gt;
&lt;li&gt;Leave the default settings, or adjust as needed:&lt;/li&gt;
&lt;li&gt;Visibility Timeout: 30 seconds (default).&lt;/li&gt;
&lt;li&gt;Message Retention: 4 days (default).&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Create Queue&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fen7k5kbs3su85wwvqp3q.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fen7k5kbs3su85wwvqp3q.webp" alt="Image description" width="800" height="367"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Creating and Deploying Lambda Functions
&lt;/h2&gt;

&lt;p&gt;We will need three Lambda functions: &lt;em&gt;ValidateTicketFunction&lt;/em&gt;, &lt;em&gt;AssignTicketFunction&lt;/em&gt;, and &lt;em&gt;NotifyCustomerFunction&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Create IAM Roles for Lambda functions&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Open the AWS Management Console and go to IAM.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Create a New Role for Each Function&lt;/strong&gt;:&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Roles&lt;/strong&gt; &amp;gt; &lt;strong&gt;Create Role&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Under &lt;strong&gt;Trusted Entity Type&lt;/strong&gt;, select &lt;strong&gt;AWS Service&lt;/strong&gt; and choose &lt;strong&gt;Lambda&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Attach the necessary permissions:&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AmazonSQSReadOnlyAccess&lt;/strong&gt; for ValidateTicketFunction.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AmazonSESFullAccess&lt;/strong&gt; for NotifyCustomerFunction.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AmazonSQSFullAccess&lt;/strong&gt; and the following Custom permission StateMachineTriggerPolicy for TriggerStateMachine function.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": "states:StartExecution",
            "Resource": "arn:aws:states:REGION:ACCOUNT_ID:stateMachine:MyStateMachine-eat9e7ot8"
        }
    ]
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Replace &lt;em&gt;REGION&lt;/em&gt; and &lt;em&gt;ACCOUNT_ID&lt;/em&gt; with your AWS region and account ID.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AWSLambdaBasicExecutionRole&lt;/strong&gt; for all functions.&lt;/li&gt;
&lt;li&gt;Name the roles appropriately (e.g., &lt;em&gt;ValidateTicketRole&lt;/em&gt;, &lt;em&gt;NotifyCustomerRole&lt;/em&gt;, &lt;em&gt;AssignTicketRole&lt;/em&gt; ,&lt;em&gt;TriggerTestMachine&lt;/em&gt;) and click &lt;strong&gt;Create Role&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnugqtpwgxzrdpbjau0c6.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnugqtpwgxzrdpbjau0c6.webp" alt="Image description" width="800" height="366"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzplybumaz0g77zosaf4q.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzplybumaz0g77zosaf4q.webp" alt="Image description" width="800" height="368"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgavciltxnmc42w3sqdu2.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgavciltxnmc42w3sqdu2.webp" alt="Image description" width="800" height="366"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx1zdtopypw7vlzm7masf.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx1zdtopypw7vlzm7masf.webp" alt="Image description" width="800" height="366"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Deploy the&lt;/strong&gt; &lt;em&gt;ValidateTicketFunction&lt;/em&gt; &lt;strong&gt;Lambda function&lt;/strong&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Navigate to the AWS Lambda Console&lt;/strong&gt;:&lt;/li&gt;
&lt;li&gt;Open &lt;strong&gt;AWS Lambda&lt;/strong&gt; from the AWS Management Console.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Create Function&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Choose &lt;strong&gt;Author from Scratch&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Fill in the details:&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Function Name&lt;/strong&gt;: &lt;em&gt;ValidateTicketFunction&lt;/em&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Runtime&lt;/strong&gt;: Select &lt;strong&gt;Python 3.9&lt;/strong&gt; or higher.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Execution Role&lt;/strong&gt;: Select &lt;strong&gt;Use an existing role&lt;/strong&gt; and choose &lt;em&gt;ValidateTicketRole&lt;/em&gt;.&lt;/li&gt;
&lt;li&gt;In the function editor, write this Python code:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import json

def lambda_handler(event, context):
    # Directly access the event data (ticket details)
    # This will be the structured input passed to the state machine
    ticket_id = event.get("ticket_id")
    customer_email = event.get("customer_email")
    issue_description = event.get("issue_description")

    # Process the message (For example, validate or log the ticket)
    print(f"Processing ticket: {ticket_id} for customer: {customer_email}")

    # You can validate or modify the input here
    if not ticket_id or not customer_email:
        raise ValueError("Missing required ticket information.")

    # Return structured output if needed
    return {
        "status": "validated", 
        "ticket_id": ticket_id,
        "customer_email": customer_email,
        "issue_description": issue_description
    }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Click &lt;strong&gt;Deploy&lt;/strong&gt; to save the changes.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F34wzewr9d3v1moo5v8ru.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F34wzewr9d3v1moo5v8ru.webp" alt="Image description" width="800" height="367"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Deploy the&lt;/strong&gt; &lt;em&gt;AssignTicketFunction&lt;/em&gt; &lt;strong&gt;Lambda function&lt;/strong&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Repeat the steps for creating a new function, this time with the following details:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Function Name&lt;/strong&gt;: &lt;em&gt;AssignTicketFunction&lt;/em&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Runtime&lt;/strong&gt;: &lt;strong&gt;Python 3.9&lt;/strong&gt; or higher.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Execution Role&lt;/strong&gt;: Select &lt;em&gt;AssignTicketRole&lt;/em&gt;.&lt;/li&gt;
&lt;li&gt;In the function editor, write this Python code:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import json

def lambda_handler(event, context):
    try:
        # The event input will be the output of the previous state (ValidateTicket)
        ticket_id = event.get("ticket_id")
        customer_email = event.get("customer_email")

        # You can perform ticket assignment logic here
        print(f"Assigning ticket: {ticket_id} to customer: {customer_email}")

        # You can return the updated status after assignment
        return {
            "status": "assigned",
            "ticket_id": ticket_id,
            "customer_email": customer_email
        }
    except KeyError as e:
        print(f"KeyError: Missing key {e}")
        return {"status": "error", "message": f"Missing key: {e}"}
    except Exception as e:
        print(f"Unexpected error: {e}")
        return {"status": "error", "message": str(e)}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Click &lt;strong&gt;Deploy&lt;/strong&gt; to save the changes.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3j0k402pt3bmxtyisxaa.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3j0k402pt3bmxtyisxaa.webp" alt="Image description" width="800" height="369"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Deploy the&lt;/strong&gt; &lt;em&gt;NotifyCustomerFunction&lt;/em&gt; &lt;strong&gt;Lambda function&lt;/strong&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Create another Lambda function with the following details:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Function Name&lt;/strong&gt;: &lt;em&gt;NotifyCustomerFunction&lt;/em&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Runtime&lt;/strong&gt;: &lt;strong&gt;Python 3.9&lt;/strong&gt; or higher.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Execution Role&lt;/strong&gt;: Select &lt;em&gt;NotifyCustomerRole&lt;/em&gt;.&lt;/li&gt;
&lt;li&gt;In the function editor, write this Python code:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import json
import boto3

def lambda_handler(event, context):
    try:
        # The event input will be the output of the previous state (AssignTicketFunction)
        ticket_id = event.get("ticket_id")
        customer_email = event.get("customer_email")

        # Send a notification (e.g., email) to the customer
        ses_client = boto3.client('ses')

        # Placeholder: send email logic here
        print(f"Notifying customer {customer_email} about ticket {ticket_id} assignment.")

        # You can implement SES email sending logic here
        # Example: ses_client.send_email(...)

        return {
            "status": "notified",
            "ticket_id": ticket_id,
            "customer_email": customer_email
        }
    except KeyError as e:
        print(f"KeyError: Missing key {e}")
        return {"status": "error", "message": f"Missing key: {e}"}
    except Exception as e:
        print(f"Unexpected error: {e}")
        return {"status": "error", "message": str(e)}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Click &lt;strong&gt;Deploy&lt;/strong&gt; to save the changes.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn3o8o8xpxkzbakn1p8dp.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn3o8o8xpxkzbakn1p8dp.webp" alt="Image description" width="800" height="367"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Defining The Step Function State Machine
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Navigate to the &lt;strong&gt;Step Functions Console&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Create State Machine&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Choose &lt;strong&gt;Blank&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Under the &lt;strong&gt;Code&lt;/strong&gt; Section, Define the state machine with the following workflow:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "Comment": "Support ticket processing workflow",
  "StartAt": "Validate Ticket",
  "States": {
    "Validate Ticket": {
      "Type": "Task",
      "Resource": "arn:aws:lambda:REGION:ACCOUNT_ID:function:ValidateTicketFunction",
      "Next": "Assign Ticket"
    },
    "Assign Ticket": {
      "Type": "Task",
      "Resource": "arn:aws:lambda:REGION:ACCOUNT_ID:function:AssignTicketFunction",
      "Next": "Notify Customer"
    },
    "Notify Customer": {
      "Type": "Task",
      "Resource": "arn:aws:lambda:REGION:ACCOUNT_ID:function:NotifyCustomerFunction",
      "End": true
    }
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Replace &lt;em&gt;REGION&lt;/em&gt; and &lt;em&gt;ACCOUNT_ID&lt;/em&gt; with your AWS region and account ID.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Create&lt;/strong&gt;, then &lt;strong&gt;Confirm&lt;/strong&gt; for the new IAM role associated with the state machine.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxpr2542wuutcca71oqk6.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxpr2542wuutcca71oqk6.webp" alt="Image description" width="800" height="368"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Configuring the Workflow Trigger
&lt;/h2&gt;

&lt;p&gt;We will create a Lambda function that is triggered by the SQS message. This Lambda function can then invoke the Step Functions state machine.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Create a Lambda Function:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Function Name&lt;/strong&gt;: &lt;em&gt;TriggerstateMachine&lt;/em&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Runtime&lt;/strong&gt;: &lt;strong&gt;Python 3.9&lt;/strong&gt; or higher.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Execution Role&lt;/strong&gt;: &lt;em&gt;Select TriggerstateMachine-role-1c75x29g&lt;/em&gt; .&lt;/li&gt;
&lt;li&gt;In the function editor, write this Python code:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import json
import boto3

def lambda_handler(event, context):
    # Initialize Step Functions client
    stepfunctions_client = boto3.client('stepfunctions')
    state_machine_arn = 'arn:aws:states:REGION:ACCOUNT_ID:stateMachine:MyStateMachine-eat9e7ot8'

    # Log the event for debugging
    print(f"Received event: {json.dumps(event)}")

    try:
        # Process the SQS message
        for record in event['Records']:
            sqs_message = json.loads(record['body'])  # Parse the SQS message body
            print(f"Parsed message: {sqs_message}")

            # Start the Step Functions execution
            response = stepfunctions_client.start_execution(
                stateMachineArn=state_machine_arn,
                name=f"execution-{record['messageId']}",  # Unique name per execution
                input=json.dumps(sqs_message)  # Convert the input back to JSON string
            )
            print(f"Step Functions response: {response}")

        return {
            'statusCode': 200,
            'body': json.dumps('Execution started for all messages')
        }

    except Exception as e:
        print(f"Error: {str(e)}")
        return {
            'statusCode': 500,
            'body': json.dumps(f"Error: {str(e)}")
        }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Replace &lt;em&gt;REGION&lt;/em&gt; &lt;em&gt;and ACCOUNT_ID&lt;/em&gt; with your AWS region and account ID.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Deploy&lt;/strong&gt; to save the changes.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Set the Lambda Function as the SQS Trigger:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Go to the &lt;strong&gt;SQS Console&lt;/strong&gt; and select &lt;em&gt;SupportTicketsQueueSQS&lt;/em&gt; queue.&lt;/li&gt;
&lt;li&gt;Under &lt;strong&gt;Lambda triggers&lt;/strong&gt;, add the &lt;em&gt;TriggerstateMachine&lt;/em&gt; function.&lt;/li&gt;
&lt;li&gt;This Lambda function will now be invoked whenever a message is sent to the SQS queue.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Testing The Workflow
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Send a test message to SQS&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Navigate to the SQS queue.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Send and receive messages&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Navigate to the SQS queue.&lt;/li&gt;
&lt;li&gt;Provide a sample JSON message:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "ticket_id": "1234",
  "customer_email": "customer@example.com",
  "issue_description": "Issue with the application"
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Replace the &lt;em&gt;customer email&lt;/em&gt; with email you have access to it.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Send Message&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Verify the workflow&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Check the &lt;strong&gt;Executions&lt;/strong&gt; tab of the created State Machine.&lt;/li&gt;
&lt;li&gt;you should see that the execution is successful under the &lt;strong&gt;Details&lt;/strong&gt; tab.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fug3yk3j4x3fnaklcrrzw.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fug3yk3j4x3fnaklcrrzw.webp" alt="Image description" width="800" height="365"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Scroll down to see the successful executions of all of the related Lambda functions and the overall state machine execution events.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftbf4stmsiap60qgjn0j3.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftbf4stmsiap60qgjn0j3.webp" alt="Image description" width="800" height="364"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkt1kg01os2d943so0rpj.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkt1kg01os2d943so0rpj.webp" alt="Image description" width="800" height="368"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;By combining AWS Lambda, SQS, and Step Functions, we’ve built a scalable, automated workflow to streamline processes and reduce manual effort. This solution highlights how these services integrate seamlessly to handle message queuing, custom logic execution, and task orchestration in a cost-effective and reliable manner.&lt;/p&gt;

&lt;p&gt;This architecture is versatile, extending beyond support ticket processing to use cases like order fulfillment and data pipelines. It scales effortlessly and minimizes infrastructure management, allowing you to focus on delivering value to your customers. Use this framework as a starting point to enhance your workflows and drive efficiency in your operations.&lt;/p&gt;




&lt;h2&gt;
  
  
  Further Reading
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://docs.aws.amazon.com/lambda/" rel="noopener noreferrer"&gt;AWS Lambda Documentation&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://docs.aws.amazon.com/step-functions/" rel="noopener noreferrer"&gt;AWS Step Functions Documentation&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://docs.aws.amazon.com/sqs/" rel="noopener noreferrer"&gt;AWS SQS Documentation&lt;/a&gt;&lt;/p&gt;

</description>
      <category>sqs</category>
      <category>lambda</category>
      <category>stepfunctions</category>
      <category>serverless</category>
    </item>
  </channel>
</rss>
