Giter Site home page Giter Site logo

davidh83110 / aws_sqs-dead-letter-queue-lambda-requeue Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 1.0 124 KB

Requeue Dead Letter Queue (DLQ) jobs with Lambda which created by Terraform (AWS SQS)

License: MIT License

Python 75.66% HCL 14.59% Makefile 9.75%
aws-lambda aws dlq sqs dead-letter-queue python3 terraform

aws_sqs-dead-letter-queue-lambda-requeue's Introduction

aws_sqs-dead-letter-queue-lambda-requeue

Requeue Dead Letter Queue jobs Lambda and Terraform

Build Status

IMPORTANT: Please Notice The Limit of Function

Loop will Break when Total Moved Job > 60
And Please Set a Timeout Value for your Lambda Function (300s is my value)

WARNING: It will be a Infinite Loop if you don't set

Terraform

Environment

  • Terraform v0.11.13
  • Terraform AWS Provider ~> 2.0

Inputs

Name Description Type Default Required
AWS_ACCOUNT string "00000000" yes
AWS_REGION string "us-east-1" yes
lambda_deployment_package Lambda deployment package name string "empty-deployment-package.zip" yes
lambda_s3_bucket_name For Put Lambda deployment package string "default-bucket" yes
lambda_stage string "prod" yes
sqs_name string "default-queue" yes

Lambda

Environment

  • Python 3.7
  • AWS SQS Source Queue
  • AWS SQS DLQ Queue
  • AWS Lambda as DLQ Handler

Requirements

  • boto3
  • logging
pip3 install boto3 logging

Limit

  • Total Moved Job > 60
  • Timeout = 300s

This is important or it will be a Infinite Loop

SQS to Lambda Event

{
    "Records": [
      {
        "messageId": "9cf06c9b-e919-4ef9-8485-3d13c347a4d1",
        "receiptHandle": "AQEBJRZxkQUWQYAwBMPpN4...rVCoU70HTdEVH4eKZXuPUVBw==",
        "body": "value0.6888803697786434",
        "attributes": {
          "ApproximateReceiveCount": "1",
          "SentTimestamp": "1530189332727",
          "SenderId": "AROAI62MWIO3S4UBJVPVG:sqs-flooder",
          "ApproximateFirstReceiveTimestamp": "1530189332728"
        },
        "messageAttributes": {},
        "md5OfBody": "7ce3453347fd9bd30281384c304a1f9d",
        "eventSource": "aws:sqs",
        "eventSourceARN": "arn:aws:sqs:us-east-1:XXXXXXXX:test-sqs-trigger-queue",
        "awsRegion": "us-east-1"
      }
    ]
  }

Flow Chart

aws_sqs-dead-letter-queue-lambda-requeue's People

Contributors

davidh83110 avatar

Watchers

 avatar

Forkers

jeremiasroma

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.