0 votes
1 view
in AWS by (17.9k points)

How can I get the aws lambda response as the HTML page? Please provide the stepwise procedure to solve this.

1 Answer

0 votes
by (42k points)

Store the HTML markup in a variable in the lambda function and then return it. So, in Node.js it is like this:

context.succeed({ variableHTML: myContentHtml })

This is an example of a mapping template:

#set($inputRoot = $input.path('$')) 

$inputRoot.variableHTML .

As you see variableHTML is the variable which contains the HTML markup passed from the lambda function. You need to create a Response model for the HTTP status. Set your Response model Content-Type as text/html. This will give you the HTML code without quotes so that the browser can recognize it as HTML.

...