In this video, we are going to create a rest API in API gateway for product microservices.
So when our API method receives an HTTP request, API gateway invokes our lambda function.
To do so, we should design our API methods that we will be exposed to the client application and redirect
to the product microservice lambda function.
In order to do that, please open the widgets to the code I have created in this section and the lecture
and create API design text document.
Basically this is the product API gateway API design.
Here you can find our route name.
Route name will be the product and under the route name we will get and post request.
This will be the HTTP methods and after that we will add resource on the product, which is the ID to
perform, get by ID, update by ID and delete by ID operations.
So let's get start to create these infrastructure on a list environment.
To do that, please open the A management console.
In a managed console, go to API Gateway.
You can see the different API types.
We will use Rest API to perform these product micro service, hands on lab click the button.
And we will follow the same steps.
These will be the rest and API.
API name will be the product API and it type will be the regional and click to create button.
So in here we will start our resources, come to actions and create a resource which name is product?
So create resource.
And under this resource we have a get method.
For that purpose, I'm going to create method, which is the get method.
Click this icon and integration type should be lambda.
Make sure that you have checked this lambda proxy integration.
This is very important.
And also we will give the lambda function as a product function.
Click the save button and give required permission with.
Okay.
After that, I'm going to add an additional method, which is the post.
So we will follow the same steps.
Lambda function check these proxy integration and give the lambda function product function click.
Say button.
Click.
Okay button.
So now we have complete these get and post operation over the route name is a product and now we should
create any resources on the product.
So that means this will be the nested resources on the product.
And after that we will create method for the get put and delete.
So let's get started.
I'm going to click the product resources, come to actions and create a name resources.
So this will be the ID that provide the product ID information, create these resources.
And under these resources I'm going to create a set of methods that will be start the gate method,
click this icon and select lambda, check this box and give required lambda function.
Click to say button, click the okay button.
So I'm going to follow the same steps for the create method for put and delete.
This is a HTTP operation.
And now I'm going to create a new method.
This will be the delete operation.
So that means delete buy ID.
Click disabled and click to okay button.
As you can see that we have created five HTTP methods with the product and product by ID resources.
So that means this API gateway can be triggered with the five invocation from the client application
and this will be redirect to the product microservices.
Product microservices should be automate all these requests and develop our actual logic, which is
the performing operations over the product table on Dynamo.
DB But we forgot the very important step which is the deploying the API.
So without deploying the API, we don't expose APIs and create endpoints for that purpose.
We come to actions and correctly deploy API button and this is required to new stage.
We can give the stage name as a production and click the deploy button.
So after that we will see that under the stage.
We have a production environment stage that is impeccable.
URL is generated from the A place and you can get every HTTP request operation from the inaugural of
the stage.
Under the stage section, you can see the we can provide the HTTP delete gate and put product by ID
specifying ID and we can get and post operation with only product resources invoking this URL.
So as you can see that we have successfully finished our infrastructure.
Now it is time to start the developing with a JavaScript version three.