Amazon Connect インスタンスに設定しているセキュリティプロファイルの「ID」と「Name」を指定して取得する方法を教えてください

2023.09.20

困っていた内容

Amazon Connect インスタンスに設定しているセキュリティプロファイルにおいて、AWS コマンドラインインターフェイス (AWS CLI) で IDName を指定して取得する方法について教えてください。

どう対応すればいいの?

ListSecurityProfiles(list-security-profiles) API の出力結果に [--query ]オプションを指定して IDName の取得をお試しください。

コマンド例: [--query ] オプションを指定なし

$ aws connect list-security-profiles \
 --instance-id ab1c2345-6789-0d12-e3fg-456hi7j890kl 
{
    "SecurityProfileSummaryList": [
        {
            "Id": "0b12a3e4-5678-9f01-ae23-4567c890123e",
            "Arn": "arn:aws:connect:ap-northeast-1:012345678901:instance/ab1c2345-6789-0d12-e3fg-456hi7j890kl/security-profile/0b12a3e4-5678-9f01-ae23-4567c890123e",
            "Name": "test-1"
        },
        {
            "Id": "1b23a4e5-6789-0f12-ae34-5678c901234e",
            "Arn": "arn:aws:connect:ap-northeast-1:012345678901:instance/ab1c2345-6789-0d12-e3fg-456hi7j890kl/security-profile/1b23a4e5-6789-0f12-ae34-5678c901234e",
            "Name": "test-2"
        },
        {
            "Id": "2b34a5e6-7890-1f23-ae45-6789c012356e",
            "Arn": "arn:aws:connect:ap-northeast-1:012345678901:instance/ab1c2345-6789-0d12-e3fg-456hi7j890kl/security-profile/2b34a5e6-7890-1f23-ae45-6789c012356e",
            "Name": "test-3"
        }
    ]
}

コマンド例: [--query ] オプションを指定あり

$ aws connect list-security-profiles \
 --instance-id ab1c2345-6789-0d12-e3fg-456hi7j890kl \
 --query 'SecurityProfileSummaryList[].[Id,Name]' 
[
    [
        "0b12a3e4-5678-9f01-ae23-4567c890123e",
        "test-1"
    ],
    [
        "1b23a4e5-6789-0f12-ae34-5678c901234e",
        "test-2"
    ],
    [
        "2b34a5e6-7890-1f23-ae45-6789c012356e",
        "test-3"
    ]
]

参考資料