AWS のメッセージングおよびストリーミング(データの継続的な送受信)サービスの一般的な使い方を説明します。Amazon SQS、Amazon SNS、Amazon EventBridge、Amazon MQ、Amazon Kinesis Data Streams、Amazon Data Firehose、Amazon Managed Service for Apache Flink、Amazon Managed Streaming for Apache Kafka(MSK)をカバーしています。 次のような場合に使用: メッセージングおよびストリーミングのパターンについて検討する必要がある場合。 また、顧客とのコミュニケーション経路ごとに対応する AWS サービスを判定します。メール(Amazon SES)、WhatsApp、SMS、MMS、RCS、音声通話、モバイルプッシュ通知(AWS End User Messaging ファミリー)ごとに、該当する専用スキルにリクエストをルーティングします。ユーザーが既に特定のチャネル(通信手段)を指定している場合は、そのチャネルの専用スキルに処理を委譲します。 一般的には、詳細なサービス固有の質問については、専用スキルまたはドキュメント検索を使用してください。MSK または Managed Service for Apache Flink についての質問には本スキルを使用せず、専用スキルを優先してください。顧客コミュニケーション経路の設定は行わず、専用スキルに委譲します。
Guides general use of AWS messaging and streaming services. Covers Amazon SQS, Amazon SNS, Amazon EventBridge, Amazon MQ, Amazon Kinesis Data Streams, Amazon Data Firehose, Amazon Managed Service for Apache Flink, and Amazon Managed Streaming for Apache Kafka (MSK). Use when reasoning about messaging and streaming patterns. Also identifies which AWS service owns each customer communication channel: email (Amazon SES), and WhatsApp, SMS, MMS, RCS, voice and mobile push (the AWS End User Messaging family of services). Routes the request to the specialized skill for that channel. Defers to the channel's specialized skill when the user already named a specific channel. In general, use specific skills or documentation searches for detailed service-specific questions. Do NOT use for MSK or Managed Service for Apache Flink questions, prefer specific skills. Does not configure customer communication channels; defers to specific skills.
AWSのメッセージングおよびストリーミングに関する質問に答える場合は、サービス固有のスキルまたは公式AWSドキュメントから、具体的な数値、バージョン、制限事項、および動作詳細を確認してください。不確実な場合は、推測するのではなくスキルまたはドキュメントで検索してください。架空の設定オプションや誤ったバージョン番号は、不確実性を認めることより悪いです。
推奨される設定(CloudWatchアラーム設定、閾値、欠損データの処理など)に関する質問の場合は、一般的なベストプラクティスに頼るのではなく、サービス固有のスキルまたはドキュメントで検索してください。
プロデューサー(データの送信元)とコンシューマー(受信側)の間でデータを移動するAWSサービスの選択と使用に関する専門知識を提供します。
このスキルは、メッセージングとストリーミングという2つの基本的なパターン、およびそれぞれを実装するAWSサービスについて説明します。さらに、顧客向けコミュニケーション(アプリケーションコンポーネント間ではなく、人へ届くメッセージ)との境界を定め、各チャネルを所有するスキルまたはAWSドキュメントにそれらの質問をルーティングします(「顧客向けコミュニケーション(アプリケーション対個人)」を参照)。
このスキルを使用して、ワークロードに適したパターンを判断し、適切なサービスを選択し、サービス間の統合方法を理解します。
個別のAWSサービスに関する具体的なガイダンスについては、リファレンスファイルまたはサービス固有のスキルを参照してください。
メッセージングにより、コンポーネント間で疎結合で非同期な通信が可能になります。プロデューサーがメッセージを送信し、1つ以上のコンシューマーがそれを受信して処理します。処理後、メッセージは通常削除されます。メッセージングサービスは、配信保証、再試行、デッドレター(処理不可メッセージ)のルーティングを処理します。
主な特徴:
ストリーミングにより、順序が保証された、永続的で高スループットの継続的なデータフローが可能になります。プロデューサーがレコード(個別データ)をログに追記し、コンシューマーはそのログ内の位置から読み取ります。レコードは消費されたかどうかに関わらず、設定可能な保持期間分保持されます。
主な特徴:
| 要素 | メッセージング | ストリーミング |
|---|---|---|
| データのライフサイクル | 消費後に削除 | リプレイ用に保持(数時間~無期限) |
| 順序付け | ベストエフォート(標準)またはグループごと(FIFO) | パーティション/シャード内で厳密 |
| コンシューマーモデル | 競合するコンシューマー(仕事配分) | 独立したリーダー(位置指定によるファンアウト) |
| スループットパターン | 変動的、バースト型 | 持続的、高容量 |
| リプレイ | 非対応(デッドレターキュー再実行を除く) | ネイティブ — 保持期間内の任意の位置にシーク可能 |
| 典型的なレイテンシ | ミリ秒(プッシュまたは短時間ポーリング) | ミリ秒から数秒 |
| スケーリング単位 | 並行処理(コンシューマー/ポーラー数) | パーティションまたはシャード |
これらのサービスは通常、メッセージングワークロードに使用されます。
ストリーミングサービス(Kinesis Data Streams、Managed Streaming for Apache Kafka)も、正確なユースケースと要件によっては、メッセージングワークロードに使用されることがあります。
| サービス | 最適な用途 | 主な特徴 |
|---|---|---|
| Amazon SQS | タスクキュー、疎結合化、バッファリング | フルマネージド、無制限のスループット(標準)、正確に1回の配信(FIFO)、マルチテナントワークロード向けの公正なキュー |
| Amazon SNS | ファンアウト、パブ・サブ通知 | 複数の購読者(SQS、Lambda、HTTP;メール/SMS エンドポイントは運用アラート向け — 顧客へのメール/SMSは「顧客向けコミュニケーション(アプリケーション対個人)」を参照)へのプッシュ |
| Amazon EventBridge | イベントルーティング、クロスアカウント/SaaS統合 | コンテンツベースのフィルタリング、スキーマレジストリ、200以上のAWSソース統合 |
| Amazon MQ | 既存JMS/AMQP/MQTTアプリの移行 | プロトコル互換性(ActiveMQ、RabbitMQ)による従来型システムの移行 |
これらのサービスは通常、ストリーミングワークロードに使用されます。
| サービス | 最適な用途 | 主な特徴 |
|---|---|---|
| Amazon Kinesis Data Streams | AWS ネイティブコンシューマーを使用したリアルタイム取り込み | オンデマンド Advantage モード(即座のスケーリング、シャード管理不要)、1~365日の保持期間 |
| Amazon Data Firehose | ストレージ・分析への管理レスフリー配信 | 自動スケーリング、バッファリング、バッチ処理、配信先への配信 |
| Amazon Managed Service for Apache Flink | 複雑なストリーム処理(結合、ウィンドウ、状態管理) | 完全な Apache Flink ランタイム — SQL、Java、Python API で状態計算が可能 |
| Amazon MSK | Kafka ネイティブワークロード、エコシステム互換性 | Apache Kafka API、Express ブローカー(スループットは3倍、スケーリングは20倍高速、標準ブローカー比)、幅広いコネクターエコシステム |
上記のサービスはアプリケーション間、同じアプリケーションのコンポーネント間でデータを移動させます。
別のグループのAWSサービスはアプリケーション対個人(A2P):これは顧客や購読者など、アプリケーション外の受信者にメッセージを配信したり、それらから受け取ったりします。
2つのグループは交換可能ではありません。
| チャネル | サービス | スキル |
|---|---|---|
| メール | Amazon SES | amazon-ses |
| AWS End User Messaging Social | aws-social-messaging |
|
| SMS、MMS、RCS、音声 | AWS End User Messaging SMS | aws-sms-voice |
| モバイルプッシュ | AWS End User Messaging Push | なし |
このセクションから直接回答する質問は2つのタイプです:ワークロードがどのグループに属するか、およびどのサービスがチャネルを所有しているか。
その他のすべての顧客向けコミュニケーション質問(チャネルの設定、チャネル経由での送信、配信のトラブルシューティング)については、このスキルから回答しないでください。代わりに、表に記載されているスキル名を読み込んで、そこから回答してください。
読み込むには、AWS MCP サーバーが利用可能な場合、表から正確な名前を使って aws___retrieve_skill(skill_name="<skill>") を使用するか、Agent Toolkit で skills/<skill>/SKILL.md からスキルドキュメントを読んでください。
表に「なし」と記載されている場合、または指定されたスキルを読み込めない場合は、そのことを説明してから、ドキュメントツール(aws___search_documentation、aws___read_documentation)が利用可能な場合それを使用するか、そうでない場合は当該AWSサービスのドキュメントを使用して回答してください。
SQS システム属性 vs. ユーザーメッセージ属性: AWSTraceHeader(X-Ray / EventBridge / Pipes が SQS デッドレターキューに送信時に設定)や SenderId、SentTimestamp などの属性は、SQS のシステム属性であり、ユーザーメッセージ属性ではありません。ReceiveMessage から デフォルトでは返されません — AttributeNames=[...](または MessageSystemAttributeNames)経由で明示的にリクエストしてください。ユーザー属性は別の MessageAttributeNames で取得します。これはデッドレターキューで重要です。トレースヘッダーはシステム属性に乗り、ユーザー属性スロットはサービスの失敗メタデータ(例:EventBridge の RULE_ARN、ERROR_CODE)を含みます。
SNS → Firehose → S3 レコード区切り: SNS サブスクリプションで Firehose プロトコルを使用して S3 に届くレコードは、デフォルトで既に改行区切り(NDJSON)です。Firehose の AppendDelimiterToRecord を有効にしないでください — SNS が改行を出力するため、プロセッサーを有効にするとダブル改行が発生します。
EventBridge ルールターゲットのデッドレターキュー + SNS サブスクリプションのデッドレターキューの両方に、キューポリシーが必要: デッドレターキューを添付するだけでは不十分です — サービスプリンシパルを許可するキューポリシーがないと、デッドレターキューはメッセージをサイレントに廃棄します。EventBridge:DeadLetterConfig.Arn=<DLQ> で PutTargets を実行、さらに SQS ポリシーで Service: events.amazonaws.com に対して sqs:SendMessage を許可、aws:SourceArn = ルール ARN。SNS:RedrivePolicy={"deadLetterTargetArn":"<DLQ>"} で SetSubscriptionAttributes を実行、さらに SQS ポリシーで Service: sns.amazonaws.com をトピック ARN でスコープして許可。
SQS 本番環境のデフォルト: ロングポーリング + カスタマーマネージドの暗号化: 新しいキューはデフォルトでショートポーリング(ReceiveMessageWaitTimeSeconds=0)および SSE-SQS(AWS owned key)です。本番環境では、SetQueueAttributes で ReceiveMessageWaitTimeSeconds=20(ロングポーリング)および KmsMasterKeyId=<customer-managed key id/ARN> を設定してください(alias/aws/sqs はそのままにしません)。
**ブローカーおよび Kafka
When answering AWS messaging and streaming questions, verify specific numbers, versions, limits, and behavioral details from service-specific skills or official AWS documentation. When uncertain, search skills or docs rather than guessing. Fabricated configuration options or incorrect version numbers are worse than admitting uncertainty.
When a question asks about recommended configurations (CloudWatch alarm settings, thresholds, missing data treatment), search for the service-specific skills or documentation rather than relying on general best practices.
Domain expertise for choosing and using AWS services that move data between producers and consumers. This skill covers two fundamental patterns — messaging and streaming — and the AWS services that implement each. It also marks the boundary with customer communication — messages delivered to people rather than to application components — and routes those questions to the skill or AWS documentation that owns each channel (see Customer Communications (Application-to-Person)). Use this skill to decide which pattern fits a workload, select the right service, and understand how services integrate with each other.
For specific guidance on individual AWS services, see reference files or service-specific Skills.
Messaging enables decoupled, asynchronous communication between components. A producer sends a message; one or more consumers receive and process it. Once processed, the message is typically deleted. Messaging services handle delivery guarantees, retries, and dead-letter routing.
Key characteristics:
Streaming enables ordered, durable, high-throughput continuous data flow. Producers append records to a log; consumers read from positions in that log. Records persist for a configurable retention period regardless of consumption.
Key characteristics:
| Dimension | Messaging | Streaming |
|---|---|---|
| Data lifecycle | Deleted after consumption | Retained for replay (hours to indefinitely) |
| Ordering | Best-effort (Standard) or per-group (FIFO) | Strict per-partition/shard |
| Consumer model | Competing consumers (work distribution) | Independent readers (fan-out by position) |
| Throughput pattern | Bursty, variable | Sustained, high-volume |
| Replay | Not supported (except DLQ redrive) | Native — seek to any position in retention |
| Typical latency | Milliseconds (push or short-poll) | Milliseconds to low seconds |
| Scaling unit | Concurrency (consumers/pollers) | Partitions or shards |
These services are generally used for messaging workloads. Sometimes streaming services (Kinesis Data Streams, Managed Streaming for Apache Kafka) are also used for messaging workloads, depending on exact use case and requirements.
| Service | Best For | Key Differentiator |
|---|---|---|
| Amazon SQS | Task queues, decoupling, buffering | Fully managed, unlimited throughput (Standard), exactly-once (FIFO), fair queues for multi-tenant workloads |
| Amazon SNS | Fan-out, pub/sub notifications | Push to multiple subscribers (SQS, Lambda, HTTP; email/SMS endpoints suit operational alerts — for customer email or SMS see Customer Communications (Application-to-Person)) |
| Amazon EventBridge | Event routing, cross-account/SaaS integration | Content-based filtering, schema registry, 200+ AWS source integrations |
| Amazon MQ | Lift-and-shift of existing JMS/AMQP/MQTT apps | Protocol compatibility (ActiveMQ, RabbitMQ) for legacy migration |
These services are generally used for streaming workloads.
| Service | Best For | Key Differentiator |
|---|---|---|
| Amazon Kinesis Data Streams | Real-time ingestion with AWS-native consumers | On-demand Advantage mode (instant scaling, no shard management), 1–365 day retention |
| Amazon Data Firehose | Zero-admin delivery to storage/analytics | Auto-scales, buffers, batches, and delivers to destinations |
| Amazon Managed Service for Apache Flink | Complex stream processing (joins, windows, state) | Full Apache Flink runtime — SQL, Java, Python APIs for stateful computation |
| Amazon MSK | Kafka-native workloads, ecosystem compatibility | Apache Kafka API, Express brokers (3x throughput, 20x faster scaling compared to Standard brokers), broad connector ecosystem |
The services above move data application-to-application, between components of the same application. A separate group of AWS services is application-to-person (A2P): it delivers messages to — or receives them from — recipients outside the application, such as customers and subscribers. The two groups are not interchangeable.
| Channel | Service | Skill |
|---|---|---|
| Amazon SES | amazon-ses |
|
| AWS End User Messaging Social | aws-social-messaging |
|
| SMS, MMS, RCS, voice | AWS End User Messaging SMS | aws-sms-voice |
| Mobile push | AWS End User Messaging Push | None |
Answer two kinds of question directly from this section: which group a workload belongs to, and which service owns a channel.
For every other customer communication question — setting up a channel, sending through it, or troubleshooting delivery — do not answer from this skill: load the skill named in the table and answer from that.
To load it, use aws___retrieve_skill(skill_name="<skill>") with the exact name from the table when the AWS MCP server is available, or read the skill document from the Agent Toolkit at skills/<skill>/SKILL.md.
Where the table says None, or the named skill cannot be loaded, say so, then answer using the documentation tools (aws___search_documentation, aws___read_documentation) if available, or the AWS documentation for the named service otherwise.
SQS system vs. user message attributes: Attributes like AWSTraceHeader (set by X-Ray / EventBridge / Pipes when sending to an SQS DLQ) and SenderId, SentTimestamp are SQS system attributes, NOT user message attributes. They are never returned by default from ReceiveMessage — request them explicitly via AttributeNames=[...] (or MessageSystemAttributeNames), separate from MessageAttributeNames which fetches user attributes. This matters for DLQs, where the trace header rides on the system attribute and the user-attributes slot carries the service's failure metadata (e.g. EventBridge's RULE_ARN, ERROR_CODE).
SNS → Firehose → S3 record separator: For SNS subscriptions using the firehose protocol that land in S3, records are already newline-delimited by default (NDJSON). Do NOT turn on Firehose's AppendDelimiterToRecord — SNS emits the newline itself, and enabling the processor produces double newlines.
EventBridge rule target DLQ + SNS subscription DLQ both need a DLQ queue policy. Attaching the DLQ alone is not enough — the DLQ silently drops messages until its queue policy allows the service principal. EventBridge: PutTargets with DeadLetterConfig.Arn=<DLQ>, plus SQS policy Allow sqs:SendMessage for Service: events.amazonaws.com with aws:SourceArn = the rule ARN. SNS: SetSubscriptionAttributes RedrivePolicy={"deadLetterTargetArn":"<DLQ>"}, plus SQS policy allowing Service: sns.amazonaws.com scoped by the topic ARN.
SQS production defaults: long polling + customer-managed encryption. New queues default to short-poll (ReceiveMessageWaitTimeSeconds=0) and SSE-SQS (AWS-owned key). For production, SetQueueAttributes with ReceiveMessageWaitTimeSeconds=20 (long polling) and KmsMasterKeyId=<customer-managed key id/ARN> rather than leaving alias/aws/sqs.
Broker and Kafka credentials belong in Secrets Manager, not connection strings. Do not hardcode usernames, passwords, or SASL/SCRAM credentials in application config, env vars, JAAS files, or IaC. For Amazon MQ (ActiveMQ/RabbitMQ) store broker users as secrets and fetch at startup; Lambda event source mappings for Amazon MQ require the broker credentials to be supplied as a Secrets Manager secret ARN (BASIC_AUTH), not inline. For MSK SASL/SCRAM the secret is not optional: it must be named with the AmazonMSK_ prefix and encrypted with a customer-managed KMS key (secrets created with the default aws/secretsmanager key cannot be associated with a cluster), then attached via BatchAssociateScramSecret. Lambda event source mappings for MSK (SASL/SCRAM or mTLS) and self-managed Kafka also reference a Secrets Manager secret ARN rather than inline credentials. Enable rotation and scope IAM read access (secretsmanager:GetSecretValue) to the consuming role only. See AWS Well-Architected SEC02-BP03 Store and use secrets securely.
Service-principal resource policies need aws:SourceArn / aws:SourceAccount conditions. When a queue or topic policy grants a service principal like events.amazonaws.com, sns.amazonaws.com, or s3.amazonaws.com permission to sqs:SendMessage or sns:Publish, omitting source conditions opens a confused-deputy hole — any rule, topic, or bucket in any AWS account can drive writes. Scope every such statement with aws:SourceArn (the specific rule/topic/bucket/pipe ARN; use ArnLike with * when the ARN isn't fully known yet) and aws:SourceAccount (your account ID). For S3 event notifications both keys are required because S3 bucket ARNs don't carry the account ID, so aws:SourceArn alone doesn't constrain the account. The same pattern applies to role trust policies for IAM roles used by EventBridge rules and EventBridge Pipes (principal events.amazonaws.com / pipes.amazonaws.com, aws:SourceArn = the rule or pipe ARN) — not just the DLQ case called out above. See the IAM User Guide on The confused deputy problem.
原文・著作権は Anthropic および各プラグイン作者に帰属します。日本語訳は Claude API による自動翻訳です。