presents by IT Consulting 109

AWS – SNSトピック情報の取得

概要

SNSの情報を取得する方法について記載しています。

Amazon Simple Notification Service (SNS)
Amazon Simple Notification Service (SNS) は柔軟なフルマネージド型の pub/sub メッセージング/モバイル通知サービスで、登録中のエンドポイントやクライアントに配信するメッセージを調整できます。SNS を使用すると、分散システムやサービス、モバイルデバイスなど、多数の受信者にメッセージをファンアウトすることができます。任意の規模のすべてのエンドポイントで通知をセットアップ、操作、および確実に送信できます。AWS マネジメントコンソール、AWS コマンドラインインターフェイス、または AWS SDK のわずか 3 つのシンプルな API を使用して、ほんの数分で SNS を使い始めることができます。SNS を使用することにより、専用メッセージングソフトウェアやインフラストラクチャの管理や運用に関連した複雑さやオーバーヘッドが排除されます。 

 

手順

aws sns list-subscriptions

実行結果 TEXT

SUBSCRIPTIONS warning@example.com 987654321000 email arn:aws:sns:ap-northeast-1:987654321000:warning:c988b83*-57c*-4b1*-abd*-bd6e3af9638* arn:aws:sns:ap-northeast-1:987654321000:warning SUBSCRIPTIONS info@example.com 987654321000 email arn:aws:sns:ap-northeast-1:987654321000:info:cb8b1bd*-aab*-486*-a0b*-d6ae24ed31a* arn:aws:sns:ap-northeast-1:987654321000:info SUBSCRIPTIONS critical@example.com 987654321000 email arn:aws:sns:ap-northeast-1:987654321000:critical:f3a2aee*-98a*-455*-9eb*-d9aca773717* arn:aws:sns:ap-northeast-1:987654321000:critical

TABLE

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|                                                                                           ListSubscriptions                                                                                          |
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
||                                                                                            Subscriptions                                                                                           ||
|+-----------------------+---------------+-----------+------------------------------------------------------------------------------------------+-----------------------------------------------------+|
||       Endpoint        |     Owner     | Protocol  |                                     SubscriptionArn                                      |                      TopicArn                       ||
|+-----------------------+---------------+-----------+------------------------------------------------------------------------------------------+-----------------------------------------------------+|
||  warning@example.com   |  987654321000 |  email    |  arn:aws:sns:ap-northeast-1:987654321000:warning:c988b83*-57c*-4b1*-abd*-bd6e3af9638*    |  arn:aws:sns:ap-northeast-1:987654321000:warning    ||
||  info@example.com      |  987654321000 |  email    |  arn:aws:sns:ap-northeast-1:987654321000:info:cb8b1bd*-aab*-486*-a0b*-d6ae24ed31a*       |  arn:aws:sns:ap-northeast-1:987654321000:info       ||
||  critical@example.com  |  987654321000 |  email    |  arn:aws:sns:ap-northeast-1:987654321000:critical:f3a2aee*-98a*-455*-9eb*-d9aca773717*   |  arn:aws:sns:ap-northeast-1:987654321000:critical   ||
|+-----------------------+---------------+-----------+------------------------------------------------------------------------------------------+-----------------------------------------------------+|

JSON

{
    "Subscriptions": [
        {
            "Owner": "987654321000",
            "Endpoint": "warning@example.com",
            "Protocol": "email",
            "TopicArn": "arn:aws:sns:ap-northeast-1:987654321000:warning",
            "SubscriptionArn": "arn:aws:sns:ap-northeast-1:987654321000:warning:c988b83*-57c*-4b1*-abd*-bd6e3af9638*"
        },
        {
            "Owner": "987654321000",
            "Endpoint": "info@example.com",
            "Protocol": "email",
            "TopicArn": "arn:aws:sns:ap-northeast-1:987654321000:info",
            "SubscriptionArn": "arn:aws:sns:ap-northeast-1:987654321000:info:cb8b1bd*-aab*-486*-a0b*-d6ae24ed31a*"
        },
        {
            "Owner": "987654321000",
            "Endpoint": "critical@example.com",
            "Protocol": "email",
            "TopicArn": "arn:aws:sns:ap-northeast-1:987654321000:critical",
            "SubscriptionArn": "arn:aws:sns:ap-northeast-1:987654321000:critical:f3a2aee*-98a*-455*-9eb*-d9aca773717*"
        }
    ]
}

 

出力結果から以下の項目が取得できます。

項目 形式 説明 対応箇所
Subscriptions list   SNS > サブスクリプション
 SubscriptionArn string サブスクリプションのARN。 サブスクリプションID
 Owner  string サブスクリプションの所有者。 受信者
 Protocol  string サブスクリプションのプロトコル。 プロトコル
 Endpoint  string サブスクリプションのエンドポイント。 エンドポイント
 TopicArn  string サブスクリプションのトピックのARN。 ARN
この記事を書いた人
名前:TRUE's。 千葉県育ち、神奈川県在住のIT系フリーエンジニア。 IT系のナレッジサイトを不定期で更新中。 フォトグラファー兼エンジニアとして日々勤しんでいる。

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です