

• Amazon Systems Manager CloudWatch 控制面板在 2026 年 4 月 30 日之后将不再可用。客户可以像现在一样继续使用 Amazon CloudWatch 控制台来查看、创建和管理其 Amazon CloudWatch 控制面板。有关更多信息，请参阅 [Amazon CloudWatch 控制面板文档](https://docs.amazonaws.cn/AmazonCloudWatch/latest/monitoring/CloudWatch_Dashboards.html)。

# 手动创建 OpsItems（PowerShell）
<a name="OpsCenter-creating-OpsItems-Powershell"></a>

以下过程介绍了如何使用 Amazon Tools for Windows PowerShell 创建 OpsItem。

**使用 Amazon Tools for Windows PowerShell 创建 OpsItem**

1. 打开 Amazon Tools for Windows PowerShell，然后运行以下命令，以指定您的凭证。

   ```
   Set-AWSCredentials –AccessKey {{key-name}} –SecretKey {{key-name}}
   ```

1. 运行以下命令，以便为 PowerShell 会话设置 Amazon Web Services 区域。

   ```
   Set-DefaultAWSRegion -Region {{Region}}
   ```

1. 运行以下命令以创建新的 OpsItem。将每个{{示例资源占位符}}替换为您自己的信息。此命令指定用于修正此 OpsItem 的 Systems Manager 自动化运行手册。

   ```
   $opsItem = New-Object Amazon.SimpleSystemsManagement.Model.OpsItemDataValue
   $opsItem.Type = [Amazon.SimpleSystemsManagement.OpsItemDataType]::SearchableString 
   $opsItem.Value = '[{\"automationId\":\"{{runbook_name}}\",\"automationType\":\"AWS::SSM::Automation\"}]'
   $newHash = @{" /aws/automations"=[Amazon.SimpleSystemsManagement.Model.OpsItemDataValue]$opsItem}
   
   New-SSMOpsItem `
       -Title "{{title}}" `
       -Description "{{description}}" `
       -Priority {{priority_number}} `
       -Source {{Amazon_service}} `
       -OperationalData $newHash
   ```

   如果成功，此命令将输出新 OpsItem 的 ID。

下面的示例指定了受损的 Amazon Elastic Compute Cloud（Amazon EC2）实例的 Amazon 资源名称（ARN）。

```
$opsItem = New-Object Amazon.SimpleSystemsManagement.Model.OpsItemDataValue
$opsItem.Type = [Amazon.SimpleSystemsManagement.OpsItemDataType]::SearchableString 
$opsItem.Value = '[{\"arn\":\"arn:aws:ec2:us-east-1:123456789012:instance/i-1234567890abcdef0\"}]'
$newHash = @{" /aws/resources"=[Amazon.SimpleSystemsManagement.Model.OpsItemDataValue]$opsItem}
New-SSMOpsItem -Title "EC2 instance disk full still" -Description "Log clean up may have failed which caused the disk to be full" -Priority 2 -Source ec2 -OperationalData $newHash
```