Create REST API

Create REST API

In this step, we will create a REST API.

  1. Use the search bar to find the API Gateway service, select REST API, then click Build.

Create API

  1. In the API details section, select New API, name the API student, and set the endpoint type to Edge-optimized.

Create API Step 2

  1. In the interface of the newly created REST API, select Create method.

Create API Step 3

  1. In the Method details interface, for Method Type choose Lambda function, and for Integration Type, select GET.

Create API Step 4

In the Lambda function section, set the region to where your account is located, then choose the correct ARN of the getStudentData function. Finally, click Create method.

Create API Step 5

  1. Repeat steps 1 through 4 to create another method. For Integration Type, select POST, and use the ARN of the insertStudentData function.

  2. In the Resource interface, select Enable CORS.

Create API Step 6

In the CORS settings interface, under Access-Control-Allow-Methods, check GET and POST, then click Save.

Create API Step 7

  1. In the Resource interface, click Deploy API, and for Stage, choose New Stage.

Create API Step 8

Set the Stage name to prod, then click Deploy.

Create API Step 9

Copy the Invoke URL after the API has been successfully created.

Create API Step 10