SSM Custom Runbook Fails

0

hi there. I am trying to create a custom runbook containing some other AWS runbooks. I receive the following error:

"Step fails when it is Executing. Fail to start automation, errorMessage: Target key can have only following values : ParameterValues, ResourceGroup or begin with tag:, AWS::EC2::Instance, InstanceIds, instanceids (Service: AmazonSSM; Status Code: 400; Error Code: InvalidAutomationExecutionParametersException; Request ID: kkk; Proxy: null). Please refer to Automation Service Troubleshooting Guide for more diagnosis details."

My Custom Runbook content is:

{
  "schemaVersion": "0.3",
  "description": "*Replace this default text with instructions or other information about your runbook.*\n\n---\n# What is Markdown?\nMarkdown is a lightweight markup language that converts your content with plain text formatting to structurally valid rich text.\n## You can add headings\nYou can add *italics* or make the font **bold**.\n1. Create numbered lists\n* Add bullet points\n>Indent `code samples`\n\nYou can create a [link to another webpage](https://aws.amazon.com).",
  "parameters": {
    "InstanceId": {
      "type": "String"
    },
    "SubnetId": {
      "type": "String"
    },
    "TopicArn": {
      "type": "String"
    }
  },
  "mainSteps": [
    {
      "name": "AWSSupport_CopyEC2Instance",
      "action": "aws:executeAutomation",
      "nextStep": "AWS_TerminateEC2Instance",
      "isEnd": false,
      "inputs": {
        "DocumentName": "AWSSupport-CopyEC2Instance",
        "Targets": [
          {
            "Key": "AWS::EC2::Subnet:Id",
            "Values": [
              "{{ SubnetId }}"
            ]
          }
        ],
        "TargetParameterName": "{{ InstanceId }}"
      }
    },
    {
      "name": "AWS_TerminateEC2Instance",
      "action": "aws:executeAutomation",
      "nextStep": "Publish",
      "isEnd": false,
      "inputs": {
        "DocumentName": "AWS-TerminateEC2Instance",
        "TargetParameterName": "{{ InstanceId }}"
      }
    },
    {
      "name": "Publish",
      "action": "aws:executeAwsApi",
      "isEnd": true,
      "inputs": {
        "TopicArn": "{{ TopicArn }}",
        "Message": "Instance was moved.",
        "Service": "sns",
        "Api": "Publish"
      }
    }
  ]
}

something wrong is with the key of the first run book for copying EC2 instances. for the key, I need subnet not instance. please help.

1 Antwort
1

Hi.

The automation target key can only be ParameterValues, ResourceGroup or begin with tag, you can find more detailed information here: https://docs.aws.amazon.com/systems-manager/latest/userguide/running-automations-map-targets.html.

In your case, You are using target key as in "Key": "AWS::EC2::Subnet:Id" which is considered as InvalidAutomationExecutionParameters

AWS
beantwortet vor 3 Monaten

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen