SSM Documents - using output data from a lambda step for another lambda step

0

I have a SSM document which has its first step to call a Lambda function (getLaunchTemplateData) using "action 'aws:invokeLambdaFunction'". The lambda function returns a set of data which is displayed on the "Output payload" on that steps results.... { "Payload": { "LaunchtemplateID": "lt-00972d7c12345678a" }, "StatusCode": 200 }

I'd like to use that output data for a step further below in the document. How can this be achieved?

I have tried adding the "outputs" tag on the 1st step using.. outputs: - Name: LaunchtemplateID Selector: $.Payload.LaunchTemplateID Type: String

Then using this as the payload for the next step which is another Lambda function...

Payload: '{ "LTID": "{{ getLaunchTemplateData.LaunchtemplateID }}" }'

but i receive this message...

{"FunctionError":"Unhandled","Payload":{"errorMessage": "An error occurred (InvalidLaunchTemplateId.Malformed) when calling the CreateLaunchTemplateVersion operation: The specified launch template ID '{{ getLaunchTemplateData.LaunchtemplateID }}' is malformed."

The Input parameters for the step that fails is not picking up the values..

"{"LTID":"{{ getLaunchTemplateData.LaunchtemplateID }}"}"

Kal
질문됨 일 년 전357회 조회
2개 답변
2

Hi,

Are the outputs of your Lambda step defined exactly as you referenced in your question?

{ "Payload": { "LaunchtemplateID": "lt-00972d7c12345678a" }, "StatusCode": 200 }
outputs:
  - Name: LaunchtemplateID
    Selector: $.Payload.LaunchTemplateID Type: String

If so, double check that you're using the proper case and variable naming. If the payload output is LaunchtemplateID the outputs selector should also use the lower-case t in Template (ie. $.Payload.LaunchtemplateID not $.Payload.LaunchTemplateID

AWS
답변함 일 년 전
0

Yes exactly right. It was the lowercase "t".

Thanks for reaching out.

Kal
답변함 일 년 전
  • Great! My pleasure!

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

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

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

관련 콘텐츠