Asynchronous Event Processing Using API Gateway, SQS, and Fargate

Asynchronous Event Processing Using API Gateway, SQS, and Fargate
Asynchronous Event Processing Using API Gateway, SQS, and Fargate

CLOUD LABS



Asynchronous Event Processing Using API Gateway, SQS, and Fargate

In this Cloud Lab, you’ll learn to build a scalable async system in AWS that avoids API time-outs, handles long-running workloads reliably, and delivers real-time results through a decoupled architecture.

12 Tasks

intermediate

2hr 30m

Certificate of Completion

Desktop OnlyDevice is not compatible.
No Setup Required
Amazon Web Services

Learning Objectives

Hands-on experience building decoupled processing workflows using Amazon SQS
The ability to implement robust job tracking and result retrieval mechanisms
Hands-on experience building and testing end-to-end asynchronous pipelines to process tasks and verify the complete workflow

Technologies
Fargate
API Gateway logoAPI Gateway
SQS logoSQS
ECR logoECR
Cloud Lab Overview

The API Gateway enforces a 29-second integration time-out, which limits how long a backend has to respond before the API returns an error. Short-running requests, whether synchronous or asynchronous, usually complete without issue. However, long-running workloads, such as text analysis, document processing, or data enrichment, can hit the time-out. Even if the backend is asynchronous in nature and continues processing in the background, API Gateway may return an error to the client, making it difficult to reliably handle these tasks. You may request a higher time-out, but there is no guarantee that their processes will always finish within the new limit. To avoid this problem and improve the reliability and responsiveness of applications, these workloads must shift to asynchronous architectures that decouple user requests from backend processing.

In this Cloud Lab, you’ll learn how to build such asynchronous architectures. You’ll start by provisioning a DynamoDB table to store job records and create an SQS queue that provides the fundamental buffering layer between the API Gateway endpoint and the backend processor.

After that, you’ll set up an Amazon ECR repository to store the container image for the processing worker, and then deploy that image using an ECS Fargate service that will continuously poll the queue and handle incoming requests. Once the backend is in place, you’ll create and configure a REST API that accepts new requests asynchronously, immediately returning a job ID rather than waiting for the processing to finish, and later retrieves the final results directly from DynamoDB. After everything is set up, you’ll test the entire architecture using a small frontend application.

After completing this Cloud Lab, you will understand how to design and operate asynchronous processing architectures on AWS that can reliably handle long-running tasks. You will learn how to eliminate API time-outs, enhance the user experience by returning instant responses, and combine services such as API Gateway, SQS, DynamoDB, and Fargate to build scalable and reliable architectures for long-running tasks.

The following is the high-level architecture diagram of the infrastructure you’ll create in this Cloud Lab:

Asynchronous event processing
Asynchronous event processing
Cloud Lab Tasks
1.Introduction
Getting Started
2.Core Infrastructure Setup
Create a DynamoDB Table for Job Tracking
Create an SQS Queue
3.Build and Deploy the Fargate Worker
Create an ECR Repository and Launch the Build Instance
Build and Push the Worker Application Container Image
Prepare the ECS Infrastructure
Configure and Launch the Fargate Worker
4.Complete and Test the Pipeline
Create the API and Integrate It with SQS
Create the Results Endpoint and Deploy the API
Test the Pipeline
5.Conclusion
Clean Up
Wrap Up
Labs Rules Apply
Stay within resource usage requirements.
Do not engage in cryptocurrency mining.
Do not engage in or encourage activity that is illegal.

Relevant Course

Use the following content to review prerequisites or explore specific concepts in detail.

Hear what others have to say
Join 1.4 million developers working at companies like