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
demandé il y a un an192 vues
1 réponse
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
répondu il y a un an

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.

Instructions pour répondre aux questions