# API Gateway Configuration

Amazon API Gateway acts as the bridge between your ownCloud setup (or Postman for testing) and the backend AWS Lambda functions. It allows secure and scalable HTTP access to your upload and delete endpoints.

In this chapter, you'll create and configure routes to trigger your `uploadFileLambda` and `deleteFileLambda` functions.

### Why API Gateway?

* Connect HTTP requests to serverless functions
* Secure your endpoints with fine-grained IAM or API keys
* Easily test with Postman, curl, or ownCloud

<figure><img src="https://385940502-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFnMLHgvRGDqrIh2UJqgH%2Fuploads%2FgJIT6duITKilIM4P5zX0%2FCCL%20-%20AWS%20(5).png?alt=media&#x26;token=b09b3127-c0c1-41c9-84ac-4f67fc9596b4" alt="" width="375"><figcaption></figcaption></figure>

### Step 1: Connect to API Gateway

1. Go to **API Gateway → Create API**
2. Choose **HTTP API** or **REST API**
3. Name the API as: `owncloud-dedup-api`

<figure><img src="https://385940502-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFnMLHgvRGDqrIh2UJqgH%2Fuploads%2FGfQLrOr82T1hRdGI9p2V%2Fimage.png?alt=media&#x26;token=486d8c2f-f778-4c40-9d7e-2bfca69ea153" alt=""><figcaption></figcaption></figure>

***

### Step 2: Create API Routes

1. Click on API name.
2. In the left navigation pane, click on routes.
3. Click on Create.
4. Select POST method from the drop-down and name it as: `dedup`&#x20;

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXcuKdIo0yCGjegBKG6waQsz3ntp8wlyb9VKg3K2LUm3CxyR0c0q2hAw5gOHi6sSs1rSI_vYGkzrowYEYrhGw6FJkyNh4PpD6MpxEbfj2AXvOUZ8naLoiiVcUrEEVKqGDSuY3taRTA?key=_DKrN84QTTX8VNbKVBwhLxv-" alt=""><figcaption></figcaption></figure>

5. Select DELETE method from the drop-down and name it as: `delete`&#x20;

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXdG5LToCv3pLFpTtmZPEq8gW4OUrjcg7W0KBLG12s3RjMzu9G0qnBbu0Eh7wGOvrndCwcbA0-Bf1h_Qm57Kyijn_UI-vgaGBRTkD8GlTHrtEn7t39s-txUd83clHloAwYJMhFsS?key=_DKrN84QTTX8VNbKVBwhLxv-" alt="" width="188"><figcaption></figcaption></figure>

6. In the left navigation pane, go to **Integrations**.
7. Add two routes:

* `POST /dedup` → linked to  `owncloud-dedup-function`
* `POST /delete` → linked to `deleteFileLambda`&#x20;

8. Deploy the API.

***
