Integrate an API with lambda
An API gateway end point can be have multiple integration types. To integrate an API with lambda as backend there are two ways. One is lambda integration and the other is lambda proxy integration. With lambda integration as the type of set up, AWS provides an ability to perform body mapping template. Below is the screenshot depicting a resource with GET method having lambda integration.
Once the resource creation is complete we should see the below screen
There are several options and configurations possible. Let us list each one of them and go through them in detail
1. Ability to quickly do a test of the end point (resource with method)
2. Method Request
3. Integration Request
4. Integration Response
5. Method Response
6. Link to Lambda function associated with the endpoint (hello in above example)
When we enable the checkbox and choose lambda proxy as the integration type then the section Integration Response become disabled. Let us dive in to the details of each of the above mentioned parts
1. Test button

This button takes us to a screen which provides an easy way to quickly test the api being developed.
On providing the necessary values and running the test we should be able to see the lambda invoked and the results along with log details related to the request
If the method that is being invoked requires header values or query parameters we can provide them in the text box. In our scenario we did not have any such requirement and hence they were empty.
Once the resource creation is complete we should see the below screen
There are several options and configurations possible. Let us list each one of them and go through them in detail
1. Ability to quickly do a test of the end point (resource with method)
2. Method Request
3. Integration Request
4. Integration Response
5. Method Response
6. Link to Lambda function associated with the endpoint (hello in above example)
When we enable the checkbox and choose lambda proxy as the integration type then the section Integration Response become disabled. Let us dive in to the details of each of the above mentioned parts
1. Test button

This button takes us to a screen which provides an easy way to quickly test the api being developed.
On providing the necessary values and running the test we should be able to see the lambda invoked and the results along with log details related to the request
If the method that is being invoked requires header values or query parameters we can provide them in the text box. In our scenario we did not have any such requirement and hence they were empty.
Comments
Post a Comment