Search code examples
amazon-web-servicesapiaws-lambdaaws-api-gateway

Relay API Gets to an API Post


I'm trying create a scheduled trigger to Get data from one API and then Post to another API. I've successfully received and posted data to each API individually using Postman. I've read and watched AWS API Gateway and Lambda documentation but I'm still confused where to start. I've created an API Gateway to get data but when I test it I get access denied from the endpoint.


Solution

  • So your scenario is that you have two APIs, most likely external, that you want to integrate with your code and create a schedule for the execution of it.

    The steps will be:

    1. Write the code that pulls data from 1st API, then makes a request to the second API
    2. Deploy it as a Lambda function (you didn't mention if you're using one of lambda supported languages, so make sure to use one)
    3. Create a schedule for Lambda, using AWS EventBridge Scheduler

    That solution will make sure:

    • your code is working fine, and the schedule is met
    • your Lambda is not exposed through any API gateway, so it's secured
    • you don't need to use API Gateway, so you save some money in the pocket