API Proxy for SQS

Integrating API Gateway with SQS (Simple Queue Service)

Pranay Sankpal
Sep 23, 2018 · 4 min read

If you want to process API Request asynchronously or add a queue in your application architecture, you landed to the right place.

This article shows how to Integrate Amazon API Gateway as a proxy for SQS (Simple Queue Service).

1. Create SQS queue

Step 1. Create SQS queue

2. Create IAM Policy

We will create IAM Policy and Role for AWS API Gateway to push Request Message to Queue.

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "VisualEditor0",
            "Effect": "Allow",
            "Action": "sqs:SendMessage",
            "Resource": "arn:aws:sqs:ap-southeast-1:123456789:sqs-lambda-demo"
        }
    ]
}

3. Create IAM Role

Step 3.1 : Create IAM Role
Step 3.2 : Save IAM role

4. Create an API Structure

Create API in AWS API Gateway
API Resource Structure

5. Integrate the API with SQS

POST method for enqueue resource

6. Modify API Request

7. Test And Deploy

{
    "data" : "test"
}

That’s it! Test your API and deploy in production.

Pranay Sankpal

Written by