Back

Explore Courses Blog Tutorials Interview Questions
0 votes
1 view
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.3k 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
Welcome to Intellipaat Community. Get your technical queries answered by top developers!

28.4k questions

29.7k answers

500 comments

94.6k users

Browse Categories

...