Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in AWS by (19.1k 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 (44.4k 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.

Related questions

Want to get 50% Hike on your Salary?

Learn how we helped 50,000+ professionals like you !

0 votes
1 answer

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...