DEV Community

Chris Norris for AWS Community Builders

Posted on

Api Gateway Simple Tutorial

CREATE A SIMPLE API GATEWAY ENDPOINT

How to create a very simple API with API Gateway.

Log into AWS and open the API Gateway module. This is where we will create an API gateway (mock for this purpose) to be used later.

1. Under API click on Create API. Then your screen will look like the screen to the left.

2. Click on Build under HTTP API. Your screen should look like one to the left.

3. For our example, enter “test-api” as the API Name and hit Review and Create, since this will be basic mock API. This will create a basic templated API. Hit Create again at the bottom. Your screen should look like one to the left.

4. Now that your API is created, you can click on routes, on the left. Your screen should look like one to the left.

5. Click “Create“ to create a test route. Your screen should look like one to the left.

6. We will now create a test method. Click on the dropdown that says “ANY” and choose “GET”. Then enter in the path /test-call in the box next to it. Your screen should look like one to the left.

7. Click Create. After the endpoint is created, click on the action “GET”. Your screen should look like one to the left.

8. Click on Attach Integration. We will choose “HTTP URI” as integration type.

Also enter the HTTP Method, “GET”, and the URL: https://catfact.ninja/fact.

I entered an optional comment.

You can as well if you want to.

Your screen should look like one to the left.

9. You now have an endpoint created. To call this endpoint, click on “Stages” on the left: Your screen should look like one to the left.

10. This has $default as a default stage. This is set to auto deploy by default. This makes it easy for us. Your screen should look like one to the left.

Text Description automatically generated11. Now you will see the invoke URL: that is the URL we will use to test our endpoint. copy and paste it into a browser and add test-call to the end of it.

Your screen should look like one to the left.

If when you browse to this link, you should see the screen above.

If so, congratulations you have created a simple API with one endpoint.

Top comments (0)