Creating OpsItems manually (PowerShell) - Amazon Systems Manager
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Creating OpsItems manually (PowerShell)

The following procedure describes how to create an OpsItem by using Amazon Tools for Windows PowerShell.

To create an OpsItem using Amazon Tools for Windows PowerShell
  1. Open Amazon Tools for Windows PowerShell and run the following command to specify your credentials.

    Set-AWSCredentials –AccessKey key-name –SecretKey key-name
  2. Run the following command to set the Amazon Web Services Region for your PowerShell session.

    Set-DefaultAWSRegion -Region Region
  3. Run the following command to create a new OpsItem. Replace each example resource placeholder with your own information. This command specifies a Systems Manager Automation runbook for remediating this OpsItem.

    $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

    If successful, the command outputs the ID of the new OpsItem.

The following example specifies the Amazon Resource Name (ARN) of an impaired Amazon Elastic Compute Cloud (Amazon EC2) instance.

$opsItem = New-Object Amazon.SimpleSystemsManagement.Model.OpsItemDataValue $opsItem.Type = [Amazon.SimpleSystemsManagement.OpsItemDataType]::SearchableString $opsItem.Value = '[{\"arn\":\"arn:aws-cn: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