Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

aws-sqs

БесплатноБез исполняемых скриптовНе проверен

Amazon SQS is AWS's managed message queue for decoupling services. Use when creating standard or FIFO queues, adding a dead-letter queue and redriving failed…

TerminalSkillsот TerminalSkills★ 221 звезда на GitHub15 установок в других каталогах

Об этом скилле

AWS SQS

Overview

Amazon Simple Queue Service (SQS) is a managed queue for decoupling producers from consumers. A standard queue has nearly unlimited throughput, at-least-once delivery and best-effort ordering. A FIFO queue (name ends in .fifo) keeps order within a message group and deduplicates for 5 minutes; without high-throughput mode it handles 300 API calls per second per action, or 3,000 messages per second when sending in batches of 10. Both types allow 1 MiB per message, 4 days of retention by default (up to 14), a 30-second default visibility timeout (0 to 12 hours), and 10 messages per batch call. Check current limits in the SQS quotas pages before sizing anything.

Instructions

  1. Set the region once. After step 2 creates the queue, the commands below use $QUEUE_URL:

    export AWS_REGION=eu-west-1
    
  2. Create a standard queue with long polling and a visibility timeout longer than your processing time:

    aws sqs create-queue --queue-name order-processing --attributes '{
      "VisibilityTimeout": "60",
      "MessageRetentionPeriod": "1209600",
      "ReceiveMessageWaitTimeSeconds": "20"
    }'
    QUEUE_URL=$(aws sqs get-queue-url --queue-name order-processing --query QueueUrl --output text)
    
  3. Create a FIFO queue only when order or dedup matters. The attribute FifoQueue is required and the name must end in .fifo:

    aws sqs create-queue --queue-name order-processing.fifo --attributes '{
      "FifoQueue": "true",
      "ContentBasedDeduplication": "true",
      "VisibilityTimeout": "60"
    }'
    

    Every FIFO send needs --message-group-id; without ContentBasedDeduplication it also needs --message-deduplication-id. Messages in one group are delivered in order and one at a time; different groups run in parallel.

  4. Add a dead-letter queue. It must be the same type as the source (FIFO source, FIFO DLQ). Give the DLQ the maximum retention (14 days) so failed messages are not expired before you look at them:

    aws sqs create-queue --queue-name order-processing-dlq --attributes '{"MessageRetentionPeriod":"1209600"}'
    DLQ_URL=$(aws sqs get-queue-url --queue-name order-processing-dlq --query QueueUrl --output text)
    DLQ_ARN=$(aws sqs get-queue-attributes --queue-url "$DLQ_URL" --attribute-names QueueArn --query Attributes.QueueArn --output text)
    aws sqs set-queue-attributes --queue-url "$QUEUE_URL" --attributes '{
      "RedrivePolicy": "{\"deadLetterTargetArn\":\"'"$DLQ_ARN"'\",\"maxReceiveCount\":\"3\"}"
    }'
    
  5. After fixing the bug that caused failures, move messages back with a message move task. Without --destination-arn they return to the queue they came from. Redriven messages count as new for retention:

    aws sqs start-message-move-task --source-arn "$DLQ_ARN"
    aws sqs list-message-move-tasks --source-arn "$DLQ_ARN"
    
  6. Send messages, one at a time or up to 10 per batch. In a batch each entry needs a unique Id (up to 80 characters of letters, digits, -, _), and a batch can partly fail, so read Failed in the response:

    aws sqs send-message --queue-url "$QUEUE_URL" \
      --message-body '{"orderId":"A-1001","action":"process"}' \
      --message-attributes '{"OrderType":{"DataType":"String","StringValue":"premium"}}'
    
    aws sqs send-message-batch --queue-url "$QUEUE_URL" --entries '[
      {"Id":"1","MessageBody":"{\"orderId\":\"A-1002\"}"},
      {"Id":"2","MessageBody":"{\"orderId\":\"A-1003\"}"}
    ]'
    
  7. Receive with long polling, process, then delete by receipt handle. A message that is not deleted reappears after the visibility timeout; extend it with change-message-visibility for slow work:

    aws sqs receive-message --queue-url "$QUEUE_URL" --max-number-of-messages 10 \
      --wait-time-seconds 20 --message-attribute-names All --attribute-names ApproximateReceiveCount
    aws sqs delete-message --queue-url "$QUEUE_URL" --receipt-handle "$RECEIPT_HANDLE"
    aws sqs change-message-visibility --queue-url "$QUEUE_URL" --receipt-handle "$RECEIPT_HANDLE" --visibility-timeout 120
    
  8. Watch queue depth and the DLQ:

    aws sqs get-queue-attributes --queue-url "$QUEUE_URL" --attribute-names \
      ApproximateNumberOfMessages ApproximateNumberOfMessagesNotVisible ApproximateNumberOfMessagesDelayed
    

Examples

Example 1: Consumer that deletes only what succeeded

User request: "Write a Python worker that reads orders from SQS in batches and doesn't lose failed ones."

This worker was run against a local SQS emulator (moto) with boto3 1.43: the good order was processed and deleted, the bad one stayed in the queue with receive count 1.

import json
import os

import boto3

sqs = boto3.client("sqs")
QUEUE_URL = os.environ["ORDERS_QUEUE_URL"]


def process_order(order: dict) -> None:
    if order.get("orderId") == "bad":
        raise ValueError("unknown order")
    print("processed", orde
Полный SKILL.md на GitHub

Установить aws-sqs в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

_scores.json

FAQ

Что делает скилл aws-sqs?

Amazon SQS is AWS's managed message queue for decoupling services. Use when creating standard or FIFO queues, adding a dead-letter queue and redriving failed messages, sending and receiving messages in batches with the AWS CLI or boto3, tuning visibility timeout and long polling, or writing an idempotent queue consumer.

Как установить скилл aws-sqs?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл aws-sqs запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить aws-sqs с