1
00:00:00,210 --> 00:00:07,440
In this video, we are going to create a rest API in API gateway when our API method receives an HTTP

2
00:00:07,440 --> 00:00:10,440
request, API Gateway invokes our lambda function.

3
00:00:10,770 --> 00:00:14,670
So to create a rest API, please open the mail console.

4
00:00:14,700 --> 00:00:16,110
Go to API gateway.

5
00:00:17,090 --> 00:00:19,900
And we will create a new API gateway.

6
00:00:19,910 --> 00:00:21,710
Which type is the API?

7
00:00:21,750 --> 00:00:24,080
Choose the type is a rest API.

8
00:00:24,110 --> 00:00:28,450
Click the boot button and this will be a rest API.

9
00:00:28,460 --> 00:00:30,580
We are going to create an API.

10
00:00:30,620 --> 00:00:38,720
Please select an API and give the name as a product API and leave the default configurations.

11
00:00:38,720 --> 00:00:39,950
Click the create button.

12
00:00:40,840 --> 00:00:45,910
So after created the waste API, we are going to create resources and methods.

13
00:00:45,910 --> 00:00:50,610
So in order to do that, come here, click actions, create resources.

14
00:00:50,620 --> 00:00:52,290
Which name is product?

15
00:00:52,300 --> 00:00:58,240
I'm going to create a product resources to manage product microservices and click to create resource

16
00:00:58,240 --> 00:00:58,810
method.

17
00:00:59,410 --> 00:01:03,040
So now after creating a resource, we should create methods.

18
00:01:03,040 --> 00:01:10,570
In order to do that, I'm going to click the resource name and click the Actions Create Method, which

19
00:01:10,570 --> 00:01:12,160
will be the guest.

20
00:01:12,430 --> 00:01:18,880
Click this icon to create a get method and this will be the lambda function integration type and we

21
00:01:18,880 --> 00:01:20,530
can use the proxy integration.

22
00:01:20,530 --> 00:01:21,250
This is important.

23
00:01:21,250 --> 00:01:27,880
You should check this box and after that provide this lambda function which is the product function.

24
00:01:27,880 --> 00:01:33,910
Click the save button and this is required permissions to invoke lambda function plus give required

25
00:01:33,910 --> 00:01:38,680
permission click the OC and this get operation is finished.

26
00:01:38,710 --> 00:01:41,680
Now we will do it for the post operation.

27
00:01:42,010 --> 00:01:49,030
Now let's create a post method, select the resource actions, create method and this should be the

28
00:01:49,390 --> 00:01:54,430
post click the OC and the integration type will be lambda function.

29
00:01:54,430 --> 00:01:58,720
And please don't forget to check this use lambda proxy integration.

30
00:01:58,720 --> 00:02:01,210
This is very important, otherwise you get exception.

31
00:02:01,210 --> 00:02:07,000
So a lambda function should be the product function and select the save button and give the required

32
00:02:07,000 --> 00:02:10,660
permission with OC operation.

33
00:02:10,660 --> 00:02:11,170
Okay.

34
00:02:11,170 --> 00:02:15,520
Now as you can see that we have create a post operation, this will be also integrate with the lambda

35
00:02:15,520 --> 00:02:17,440
function, which name is product function.

36
00:02:17,440 --> 00:02:21,940
So I'm going to continue with the get buy ID and delete my idea for that purpose.

37
00:02:21,940 --> 00:02:24,130
Select the resource actions.

38
00:02:24,130 --> 00:02:29,380
This time we are going to create resource under the product resource for that purpose.

39
00:02:29,380 --> 00:02:32,770
I'm going to the ID statement in here.

40
00:02:32,800 --> 00:02:38,410
This will be the resource pet for ID information that we can get a pet parameters.

41
00:02:38,410 --> 00:02:45,850
This ID information create resources and this will be created under the product resources and with ID

42
00:02:45,850 --> 00:02:49,180
information we can go to actions and create method.

43
00:02:49,210 --> 00:02:52,420
Under the ID we can get buy ID operation.

44
00:02:52,420 --> 00:02:57,580
You can click the get method and select the same configuration.

45
00:02:57,580 --> 00:02:59,500
This will be applied to get by.

46
00:02:59,500 --> 00:03:06,670
ID give the required permissions and the same way I'm going to go to actions create method.

47
00:03:06,670 --> 00:03:09,370
This time this will be the http delete.

48
00:03:09,370 --> 00:03:13,570
So that means delayed by ID again the lambda function.

49
00:03:13,570 --> 00:03:19,690
Check this box and come to product function and click this button and click okay.

50
00:03:22,350 --> 00:03:23,010
Okay.

51
00:03:23,130 --> 00:03:28,410
In the last step, we need to deploy the API so that we can access through the public URL.

52
00:03:28,440 --> 00:03:33,890
For that purpose, come to the actions and you can see the deploy API button.

53
00:03:33,900 --> 00:03:35,350
Click to deploy API.

54
00:03:35,640 --> 00:03:39,130
In this deployment stage, we should create a deployment stage.

55
00:03:39,150 --> 00:03:43,710
So I'm going to give a stage name as a production and click the deploy button.

56
00:03:44,550 --> 00:03:50,760
So now as you can see that we have deployed this rest API successfully, now it is ready for the get

57
00:03:50,760 --> 00:03:52,280
request from this URL.

58
00:03:52,320 --> 00:03:59,430
You can get a specific URL from the get product post product and delete my ID and get my ID operations.
