SSM Automation Document aws:executeAwsApi - CreateTags does not run inside with SSM Maintenace window
0
Hello together,
I have a somewhat strange phenomenon with SSM Automation and Maintenance Windows.
The Automation Document run under SSM -> Automation -> Execute Automation
or direct from the Document it self perfectly.
But if the document is scheduled in the SSM "Maintenace Windows" and the targets are defined
for example as a ResourceGroup. Than the function aws:executeAwsApi CreateTags fails with the message:
"Step fails when it is Execute/Cancelling action. An error occurred (InvalidParameterValue) when calling the CreateTags operation: Value ( null ) for parameter resourceId is invalid. Null/empty value for resourceId is invalid. "
I am guessing that there is a bug in the SSM Windows Maintenace function, and the parameter passing or mapping for aws:executeAwsApi is working incorrect.
So here the Code in YAML :
description: Start einer EC2 Instanz and set Tag.
schemaVersion: '0.3'
assumeRole: '{{ AutomationAssumeRole }}'
parameters:
TagKey:
type: String
description: Set Tag Name
default: SY-AutoPatch
TagValue:
type: String
description: Value for the Tag
default: '1'
InstanceId:
type: StringList
AutomationAssumeRole:
type: String
description: 'Optional ARN Rolle '
default: ""
mainSteps:
- name: CreateTags
action: 'aws:executeAwsApi'
inputs:
Service: EC2
Api: CreateTags
DryRun: false
Resources:
- '{{ InstanceId }}'
Tags:
- Key: '{{ TagKey }}'
Value: '{{ TagValue }}'
- name: startInstances
action: 'aws:changeInstanceState'
inputs:
InstanceIds: '{{ InstanceId }}'
DesiredState: running