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
질문됨 일 년 전310회 조회
1개 답변
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

답변함 일 년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠