Access Database on Atlas through AWS API Gatway

Hii All,

I have a use case where I want to access the Atlas database through my AWS. For this, I used Data API with API Gateway but this API is giving 3000ms latency, which is too much. My cluster is hosted in AWS Mumbai Region, I also tried VPC Peering but don’t have any idea how to connect from here.

Is there any way to connect Atlas database through API Gateway? My ultimate goal is to read and write data through an API so that I can use this in my application.

Thanks in Advance!!

Hi Hemendra - what kind of queries are you running? You will be able to get much better latency by setting your data api to be deployed in a single region, since currently your request is probably going from your API gateway → sydney (data api) → mumbai (atlas cluster). Other things to consider are indexing your queries and potentially sizing up your Atlas cluster tier.

to do this you can:

  1. Go to App Services
  2. Click ’ Create new app
  3. In the form, choose ‘Advanced’ and choose a local setting
  4. Go to Rules , and create default read and write for your linked cluster
  5. Go to Authentication and enable ’ api key '. Save that config, then create an API key.
  6. Go to HTTPS endpoints and click on the Data API tab. Enable the Data API.

(Note: you’ll have a different URL)

1 Like

That is very awesome, and things are start working for me now. I create new app in the same region as cluster. But one thing that we have to consider is that we have to make service name the same as cluster name in Linked Data Sources.

to do so you can:

  1. Go to App Services
  2. Select your app
  3. Go to Linked Data Sources , and click on Link a Data Source
  4. Choose a data source and service name. The service name should be the same as the cluster name.

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.