Receiving Validation Error on Payload input (Lambda) when using via SSM Automation Document

0

Hello,

I've cloned the AWS-UpdateWindowsAMI document and added two steps for invoking Lamda function to update the parameter store with the latest AMI ID and creating EC2 tags. I'm getting the error below when I run into the aws:invokelambdafunction block. Everything else works.

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.

I've copied the LamdaFunction code straight of this document. This is the updatessmparam code in the document. I've only replaced the parameterName in the code.

{

  "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}}\"}"
  }
},

Any help would be appreciated. Thanks.

Justin

已提問 2 年前檢視次數 1082 次
3 個答案
0
已接受的答案

I think it might be case-sensitive, and your step name is CreateImage with a capital "C". Does it work if you change the value in updateSsmParam's Payload to CreateImage.ImageId?

profile pictureAWS
專家
James_S
已回答 2 年前
0

Ok, I've updated the document. I'm running it again. Will let you know whether that worked or not.

已回答 2 年前
0

That worked. Thanks again.

已回答 2 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南