OpsItems のタグ付け
このセクションのトピックでは、OpsItems のタグの使用方法について説明します。
タグを使用した OpsItems の作成
コマンドラインツールを使用すると、カスタム AWS Systems Manager OpsItems を作成するときにタグを追加できます。
詳細については、次のトピックを参照してください。
既存の OpsItems へのタグの追加
コマンドラインツールを使用して OpsItems にタグを追加できます。
既存の OpsItem へのタグの追加 (コマンドライン)
既存の OpsItem にタグを追加するには (コマンドライン)
-
任意のコマンドラインツールを使用して次のコマンドを実行することによって、タグ付けできる OpsItem の一覧を表示します。
- Linux & macOS
-
aws ssm describe-ops-items
- Windows
-
aws ssm describe-ops-items
- PowerShell
-
Get-SSMOpsItemSummary
タグ付けする OpsItem の ID を書き留めます。
-
OpsItem にタグを付けるには、次のコマンドを実行します。各リソースプレースホルダーの例
をユーザー自身の情報に置き換えます。
- Linux & macOS
-
aws ssm add-tags-to-resource \
--resource-type "OpsItem" \
--resource-id "ops-item-id
" \
--tags "Key=tag-key
,Value=tag-value
"
- Windows
-
aws ssm add-tags-to-resource ^
--resource-type "OpsItem" ^
--resource-id "ops-item-id
" ^
--tags "Key=tag-key
,Value=tag-value
"
- PowerShell
-
$tag = New-Object Amazon.SimpleSystemsManagement.Model.Tag
$tag.Key = "tag-key
"
$tag.Value = "tag-value
"
Add-SSMResourceTag `
-ResourceType "OpsItem" `
-ResourceId "ops-item-id
" `
-Tag $tag `
-Force
成功した場合は、コマンドの出力はありません。
-
OpsItem のタグを確認するには、次のコマンドを実行します。
- Linux & macOS
-
aws ssm list-tags-for-resource \
--resource-type "OpsItem" \
--resource-id "ops-item-id
"
- Windows
-
aws ssm list-tags-for-resource ^
--resource-type "OpsItem" ^
--resource-id "ops-item-id
"
- PowerShell
-
Get-SSMResourceTag `
-ResourceType "OpsItem" `
-ResourceId "ops-item-id
"
Systems Manager OpsItems からタグを削除
コマンドラインツールを使用して、Systems Manager OpsItems からタグを削除できます。
OpsItems からのタグの削除 (コマンドライン)
-
任意のコマンドラインツールを使用して次のコマンドを実行することによって、アカウントの OpsItems の一覧を表示します。
- Linux & macOS
-
aws ssm describe-ops-items
- Windows
-
aws ssm describe-ops-items
- PowerShell
-
Get-SSMOpsItemSummary
タグを削除する OpsItem の名前を書き留めます。
-
次のコマンドを実行して、OpsItem からタグを削除します。example resource placeholder
を自分の情報に置き換えます。
- Linux & macOS
-
aws ssm remove-tags-from-resource \
--resource-type "OpsItem" \
--resource-id "ops-item-id
" \
--tag-key "tag-key
"
- Windows
-
aws ssm remove-tags-from-resource ^
--resource-type "OpsItem" ^
--resource-id "ops-item-id
" ^
--tag-key "tag-key
"
- PowerShell
-
Remove-SSMResourceTag `
-ResourceId "ops-item-id
" `
-ResourceType "OpsItem" `
-TagKey "tag-key
" `
-Force
成功した場合は、コマンドの出力はありません。
-
OpsItem のタグを確認するには、次のコマンドを実行します。
- Linux & macOS
-
aws ssm list-tags-for-resource \
--resource-type "OpsItem" \
--resource-id "ops-item-id
"
- Windows
-
aws ssm list-tags-for-resource ^
--resource-type "OpsItem" ^
--resource-id "ops-item-id
"
- PowerShell
-
Get-SSMResourceTag `
-ResourceType "OpsItem" `
-ResourceId "ops-item-id
"