Serverless technologies like AWS Lambda allow us to build our applications out of small, independent functions that can be called based on events such as an API call.
By default, it's not possible to call a lambda function from the Internet - it's safely stored within AWS cloud, following the principle of least privilege.
In order to create a REST API to call a lambda function we need to use API Gateway. Luckily, with AWS CDK, we can create a
LambdaRestApi in 3 lines of code and this is exactly what we're going to learn in this quick lesson!
In order to see the body returned by your lambda function in the browser, the Content-Type needs to be changed from plain/text to application.json
Leaving it as plain/text will just download a file to your computer instead of displaying the message in the browser. I believe this step was skipped in this lesson.
Also, if you do not see the api endpoints listed when scrolling down, you need to click on the "API Gateway" box within the designer.
Running "cdk diff" with the packages at version 1.55.0 works fine. However the newest (08.08.2020) version 1.57.0 would throw an error:
$ cdk diff
unable to determine cloud assembly output directory. Assets must be defined indirectly within a "Stage" or an "App" scope"
Thanks for the notice, I’ll take a look as soon as I can :)
Tomasz, thanks for the great course.
I have to do yarn build, after that
cdk diff shows diff.