

• AWS Systems Manager CloudWatch ダッシュボードは、2026 年 4 月 30 日以降は利用できなくなります。お客様は、これまでと同様に Amazon CloudWatch コンソールを使用して、Amazon CloudWatch ダッシュボードの表示、作成、管理を継続できます。詳細については、「[Amazon CloudWatch ダッシュボードのドキュメント](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Dashboards.html)」を参照してください。

# OpsItems の手動作成 (AWS CLI)
<a name="OpsCenter-creating-OpsItems-CLI"></a>

次の手順では、AWS Command Line Interface (AWS CLI) を使用して OpsItem を作成する方法について説明します。

**AWS CLI を使用して OpsItem を作成するには**

1. まだ AWS Command Line Interface (AWS CLI) をインストールして設定していない場合は、インストールして設定します。

   詳細については、「[AWS CLI の最新バージョンをインストールまたは更新します。](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html)」を参照してください。

1. AWS CLI を開き、以下のコマンドを実行して OpsItem を作成します。各{{リソースプレースホルダーの例}}をユーザー自身の情報に置き換えます。

   ```
   aws ssm create-ops-item \
       --title "{{Descriptive_title}}" \
       --description "{{Information_about_the_issue}}" \
       --priority {{Number_between_1_and_5}} \
       --source {{Source_of_the_issue}} \
       --operational-data {{Up_to_20_KB_of_data_or_path_to_JSON_file}} \
       --notifications Arn="{{SNS_ARN_in_same_Region}}" \
       --tags "Key={{key_name}},Value={{a_value}}"
   ```

   **ファイルから運用データを指定する**

   OpsItem を作成する場合、ファイルから運用データを指定することができます。ファイルは JSON ファイルで、ファイルの内容には、次の形式を使用する必要があります。

   ```
   {
     "{{key_name}}": {
       "Type": "SearchableString",
       "Value": "{{Up to 20 KB of data}}"
     }
   }
   ```

   以下はその例です。

   ```
   aws ssm create-ops-item ^
       --title "EC2 instance disk full" ^
       --description "Log clean up may have failed which caused the disk to be full" ^
       --priority 2 ^
       --source ec2 ^
       --operational-data file:///Users/TestUser1/Desktop/OpsItems/opsData.json ^
       --notifications Arn="arn:aws:sns:us-west-1:12345678:TestUser1" ^
       --tags "Key=EC2,Value=Production"
   ```
**注記**  
さまざまなローカルオペレーティングシステムでコマンドラインに JSON 形式のパラメータを入力する方法については、*AWS Command Line Interface ユーザーガイド*の「[AWS CLI で文字列に引用符を使用する](https://docs.aws.amazon.com/cli/latest/userguide/cli-usage-parameters-quoting-strings.html)」を参照してください。

   システムが以下のような情報をレスポンスします。

   ```
   {
       "OpsItemId": "oi-1a2b3c4d5e6f"
   }
   ```

1. 以下のコマンドを実行して、作成した OpsItem の詳細を表示します。

   ```
   aws ssm get-ops-item --ops-item-id {{ID}}
   ```

   システムが以下のような情報をレスポンスします。

   ```
   {
       "OpsItem": {
           "CreatedBy": "arn:aws:iam::12345678:user/TestUser",
           "CreatedTime": 1558386334.995,
           "Description": "Log clean up may have failed which caused the disk to be full",
           "LastModifiedBy": "arn:aws:iam::12345678:user/TestUser",
           "LastModifiedTime": 1558386334.995,
           "Notifications": [
               {
                   "Arn": "arn:aws:sns:us-west-1:12345678:TestUser"
               }
           ],
           "Priority": 2,
           "RelatedOpsItems": [],
           "Status": "Open",
           "OpsItemId": "oi-1a2b3c4d5e6f",
           "Title": "EC2 instance disk full",
           "Source": "ec2",
           "OperationalData": {
               "EC2": {
                   "Value": "12345",
                   "Type": "SearchableString"
               }
           }
       }
   }
   ```

1. 次のコマンドを実行して OpsItem を更新します。このコマンドでは、ステータスを `Open` (デフォルト) から `InProgress` に変更します。

   ```
   aws ssm update-ops-item --ops-item-id {{ID}} --status InProgress
   ```

   コマンドには出力がありません。

1. 次のコマンドを再度実行し、ステータスが `InProgress` に変更されていることを確認します。

   ```
   aws ssm get-ops-item --ops-item-id {{ID}}
   ```

## OpsItem の作成例
<a name="OpsCenter_creating_OpsItems-CLI_examples"></a>

次のコード例は、Linux 管理ポータルmacOS、または Windows Server を使用して OpsItem を作成する方法を示します。

**Linux 管理ポータル、または macOS**

次のコマンドは、Amazon Elastic Compute Cloud (Amazon EC2) インスタンスディスクがいっぱいになったときに OpsItem を作成します。

```
aws ssm create-ops-item \
    --title "EC2 instance disk full" \
    --description "Log clean up may have failed which caused the disk to be full" \
    --priority 2 \
    --source ec2 \
    --operational-data '{"EC2":{"Value":"12345","Type":"SearchableString"}}' \
    --notifications Arn="arn:aws:sns:us-west-1:12345678:TestUser1" \
    --tags "Key=EC2,Value=ProductionServers"
```

次のコマンドは、`OperationalData` の `/aws/resources` キーを使用して、Amazon DynamoDB 関連リソースを持つ OpsItem を作成します。

```
aws ssm create-ops-item \
    --title "EC2 instance disk full" \
    --description "Log clean up may have failed which caused the disk to be full" \
    --priority 2 \
    --source ec2 \
    --operational-data '{"/aws/resources":{"Value":"[{\"arn\": \"arn:aws:dynamodb:us-west-2:12345678:table/OpsItems\"}]","Type":"SearchableString"}}' \
    --notifications Arn="arn:aws:sns:us-west-2:12345678:TestUser"
```

以下のコマンドは、`OperationalData` の `/aws/automations` キーを使用して、関連付けられた Automation ランブックとして `AWS-ASGEnterStandby` ドキュメントを指定する OpsItem を作成します。

```
aws ssm create-ops-item \
    --title "EC2 instance disk full" \
    --description "Log clean up may have failed which caused the disk to be full" \
    --priority 2 \
    --source ec2 \
    --operational-data '{"/aws/automations":{"Value":"[{\"automationId\": \"AWS-ASGEnterStandby\", \"automationType\": \"AWS::SSM::Automation\"}]","Type":"SearchableString"}}' \
    --notifications Arn="arn:aws:sns:us-west-2:12345678:TestUser"
```

**Windows**

次のコマンドは、Amazon Relational Database Service (Amazon RDS) インスタンスが応答しない場合に OpsItem を作成します。

```
aws ssm create-ops-item ^
    --title "RDS instance not responding" ^
    --description "RDS instance not responding to ping" ^
    --priority 1 ^
    --source RDS ^
    --operational-data={\"RDS\":{\"Value\":\"abcd\",\"Type\":\"SearchableString\"}} ^
    --notifications Arn="arn:aws:sns:us-west-1:12345678:TestUser1" ^
    --tags "Key=RDS,Value=ProductionServers"
```

以下のコマンドは、`OperationalData` の `/aws/resources` キーを使用して、Amazon EC2 インスタンスの関連リソースを持つ OpsItem を作成します。

```
aws ssm create-ops-item ^
    --title "EC2 instance disk full" ^
    --description "Log clean up may have failed which caused the disk to be full" ^
    --priority 2 ^
    --source ec2 ^
    --operational-data={\"/aws/resources\":{\"Value\":\"[{\\"""arn\\""":\\"""arn:aws:ec2:us-east-1:123456789012:instance/i-1234567890abcdef0\\"""}]\",\"Type\":\"SearchableString\"}}
```

次のコマンドは、`OperationalData` の `/aws/automations` キーを使用して、関連付けられた Automation ランブックとして `AWS-RestartEC2Instance` ランブックを指定する OpsItem を作成します。

```
aws ssm create-ops-item ^
    --title "EC2 instance disk full" ^
    --description "Log clean up may have failed which caused the disk to be full" ^
    --priority 2 ^
    --source ec2 ^
    --operational-data={\"/aws/automations\":{\"Value\":\"[{\\"""automationId\\""":\\"""AWS-RestartEC2Instance\\”"",\\"""automationType\\""":\\"""AWS::SSM::Automation\\"""}]\",\"Type\":\"SearchableString\"}}
```