The Payload parameter for Lambda must be valid JSON

0

I have a Maintenance Window which runs a Lambda as one of the Tasks. Within the Task i have specified the Payload as "{{RESOURCE_ID}}". This is so that the Lambda can execute against the instance list within a defined Resource Group. This Resource Group is defined within the Maintenance Window Targets page. This all works fine....

I'm now trying to build this using a cloudformation template with the Lambda task details within "AWS::SSM::MaintenanceWindowTask". The problem i'm having is that i've tried various formats of entering the Payload information under... "TaskInvocationParameters: "MaintenanceWindowLambdaParameters:"

... but i'm not able to successfully load the template. It keeps failing with "The Payload parameter for Lambda must be valid JSON" The AWS docs specify that the Payload data needs to be converetd to Base64. I've tried the following formats which have all failed with the same message....

Payload: !Base64 '{"instanceId": ["{{RESOURCE_ID}}"]}'

Payload: !Base64 {"instanceId": ["{{RESOURCE_ID}}"]}
Payload: !Base64 '{{RESOURCE_ID}}'
Payload: {"Fn::Base64" : "{{RESOURCE_ID}}"}
Payload: "{{RESOURCE_ID}}"
Payload: !Base64 '{"instanceId": "{{RESOURCE_ID}}"}'

Any ideas where i'm going wrong?

Kal
質問済み 1年前192ビュー
1回答
0

Have you tried passing the value from Cloudformation by using the Fn::Base64?

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-base64.html

AWS
vtjean
回答済み 1年前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ