在使用SSM Automation Document时,通过Lambda进行操作收到负载输入的验证错误,请问一般是什么原因?

0

【以下的问题经过翻译处理】 ``` 我克隆了 AWS-UpdateWindowsAMI 文档,并添加了两个步骤来调用 Lambda 函数来更新参数存储中的最新 AMI ID 和创建 EC2 tag。当我运行到 aws:invokelambdafunction 时,会出现以下错误,其他内容是正常的。

Step fails when it is validating and resolving the step inputs. Failed to resolve input: createImage.ImageId to type String. createImage is not defined in Automation Document MainSteps.. Please refer to Automation Service Troubleshooting Guide for more diagnosis details. VerificationErrorMessage Failed to resolve input: createImage.ImageId to type String. createImage is not defined in Automation Document MainSteps.

我直接从 此文档 中复制了 Lambda 函数代码。这是文档中的 updatessmparam 代码。我只在代码中替换了 parameterName。 { "name": "CreateImage", "action": "aws:createImage", "maxAttempts": 3, "onFailure": "Abort", "inputs": { "InstanceId": "{{ LaunchInstance.InstanceIds }}", "ImageName": "{{ TargetAmiName }}", "NoReboot": true, "ImageDescription": "{{ TargetImageDescription }}" } }, { "name": "TerminateInstance", "action": "aws:changeInstanceState", "maxAttempts": 3, "onFailure": "Abort", "inputs": { "InstanceIds": [ "{{ LaunchInstance.InstanceIds }}" ], "DesiredState": "terminated" } }, { "name": "updateSsmParam", "action": "aws:invokeLambdaFunction", "timeoutSeconds": 1200, "maxAttempts": 1, "onFailure": "Continue", "inputs": { "FunctionName": "Automation-UpdateSsmParam", "Payload": "{"parameterName":"/ami/latest/us-east-1/win2k19sf-cb", "parameterValue":"{{createImage.ImageId}}"}" } },

profile picture
EXPERTE
gefragt vor 5 Monaten38 Aufrufe
1 Antwort
0

【以下的回答经过翻译处理】 应该是区分大小写,并且你的步骤名称是带有大写字母“C”的“CreateImage”。如果将 updateSsmParam 的 Payload 中的值更改为 CreateImage.ImageId 是否可以?

profile picture
EXPERTE
beantwortet vor 5 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