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
asked a year ago188 views
1 Answer
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
answered 10 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions