Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

New pattern submission: sqs to lambda managed instance with provisioned mode esm

Aperta
#3,002 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
25/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Ferma
Stack tecnologico
aws
Ambito
backend, cloud

Direzione di ricerca

Esamina prima la pull request #3001, poiché l’issue vi fa riferimento. Poi ispeziona il template.yml del pattern e segui i comandi documentati sam build, sam deploy, SQS message, log ed event-source-mapping; il lavoro è completato quando il pattern SQS-to-Lambda viene distribuito e il suo comportamento ESM provisionato può essere verificato come descritto.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Amazon SQS + Lambda Managed Instances (LMI) with Provisioned Mode ESM

This pattern deploys an Amazon SQS Standard Queue connected to an AWS Lambda function via an Event Source Mapping (ESM) configured with Provisioned Mode — an ESM feature that pre-allocates dedicated polling resources for predictable, high-throughput message processing.

Learn more about this pattern at Serverless Land Patterns: https://serverlessland.com/patterns/sqs-lambda-lmi-esm-provisioned-sam

Important: this application uses various AWS services and there are costs associated with these services after the Free Tier usage - please see the AWS Pricing page for details. You are responsible for any AWS costs incurred. No warranty is implied in this example.

Requirements

Build Instructions

  1. From the command line, use AWS SAM to build the AWS resources for the pattern as specified in the template.yml file:
    sam build
    

Deployment Instructions

  1. Create a new directory, navigate to that directory in a terminal and clone the GitHub repository:

    git clone https://github.com/aws-samples/serverless-patterns
    
  2. Change directory to the pattern directory:

    cd sqs-lambda-lmi-esm-provisioned-sam
    
  3. From the command line, use AWS SAM to deploy the AWS resources for the pattern as specified in the template.yml file:

    sam deploy --guided
    
  4. During the prompts:

    • Enter a stack name
    • Enter the desired AWS Region
    • Accept the default parameter values or tune them for your workload
    • Allow SAM CLI to create IAM roles with the required permissions.

    Once you have run sam deploy --guided mode once and saved arguments to a configuration file (samconfig.toml), you can use sam deploy in future to use these defaults.

  5. Note the outputs from the SAM deployment process. These contain the resource names and/or ARNs which are used for testing.

How it works

  1. A producer (any AWS service, SDK client, or CLI) sends messages to the SQS Standard Queue.
  2. The ESM's provisioned event pollers continuously long-poll the queue using up to 10 SQS API calls per second per poller.
  3. When messages are available, pollers assemble batches (up to BatchSize messages, waiting up to MaxBatchingWindowInSeconds) and invoke the Lambda function concurrently.
  4. Lambda scales the number of active pollers between MinimumPollers and MaximumPollers based on queue depth, adding up to 1,000 concurrent executions per minute.
  5. If a message fails processing after 3 attempts (maxReceiveCount), it is moved to the Dead Letter Queue.
  6. A CloudWatch Alarm fires as soon as any message lands in the DLQ.

Testing

  1. Get the queue URL from the stack outputs:
aws cloudformation describe-stacks \
  --stack-name <your-stack-name> \
  --query "Stacks[0].Outputs"
  1. Send test messages:
QUEUE_URL=<QueueUrl from outputs>

# Send a single message
aws sqs send-message \
  --queue-url $QUEUE_URL \
  --message-body '{"orderId": "123", "amount": 99.99}'

# Send a batch of 10
for i in $(seq 1 10); do
  aws sqs send-message \
    --queue-url $QUEUE_URL \
    --message-body "{\"orderId\": \"$i\", \"amount\": $((RANDOM % 100))}"
done
  1. Check Lambda logs:
sam logs --stack-name <your-stack-name> --tail
  1. Inspect the ESM status and poller count:
ESM_ID=<EventSourceMappingId from outputs>

aws lambda get-event-source-mapping --uuid $ESM_ID

Cleanup

  1. Delete the stack
    aws cloudformation delete-stack --stack-name STACK_NAME
    
  2. Confirm the stack has been deleted
    aws cloudformation list-stacks --query "StackSummaries[?contains(StackName,'STACK_NAME')].StackStatus"
    

Copyright 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved.

SPDX-License-Identifier: MIT-0

GitHub PR :

https://github.com/aws-samples/serverless-patterns/pull/3001

Lingua principale
Python
Stelle
1.8k
Fork
1.1k
Merge medio
4g 9h
PR unite (30g)
6

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di aws-samples/serverless-patterns

Tutte le issue di aws-samples/serverless-patterns

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.