Managing Maintenance Window Tasks using {{RESOURCE_ID}}

0

I have a SSM Maintenance Window with instance targets linked via a Resource Group. So the tasks associated with this Maintenance Window make use of the {{RESOURCE_ID}} parameter. Applying the {{RESOURCE_ID}} to a task which calls an AWS document works fine. Such as AWS-StartEC2Instance and AWS-StopEC2Instance. I'm now trying to use the {{RESOURCE_ID}} with a new document which executes a powershell script. When i build a new document there is the option to specify the "InputPayload" which i am setting as " InstanceIds : "{{RESOURCE_ID}}", but when i execute the document i get the error...

" Step fails when it is validating and resolving the step inputs. Failed to resolve input: RESOURCE_ID to type Integer or Boolean or String or StringList or StringMap or MapList. RESOURCE_ID is not defined in the Automation Document "

The document content looks like this....

description: TEST schemaVersion: '0.3' mainSteps:

  • name: Main action: 'aws:executeScript' inputs: Runtime: PowerShell Core 6.0 Script: |- Write-Host 'hello world'; $inputPayload = $env:InputPayload | ConvertFrom-Json; <#$parameter = $inputPayload.events.parameter;#> Write-Host $inputPayload.context; return @{message='hello'} InputPayload: InstanceIds: '{{RESOURCE_ID}}'

Any ideas where i'm going wrong with this?

Kal
asked a year ago292 views
1 Answer
0

You didn't specify what kind of Powershell script you were executing, or how you planned on executing the SSM document. (guessing a maintenance window?). The error you received states the input 'RESOURCE_ID' was never specified. I couldn't make much sense of your document content with the error. But, your fix is here -- > https://docs.aws.amazon.com/systems-manager/latest/userguide/automation-action-executeScript.html

answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions