How to use postgres rest api in AWS

0

Hi Team, we are currently using the postgrest api (https://postgrest.org/en/stable/) in AWS EC2 instance .

Do we have any service offered by AWS. Please do let me know which service have to used ? we are planning to use it on Production not sure which service is reliable and provided by AWS.

asked 2 years ago2817 views
2 Answers
0
profile picture
answered 2 years ago
0

Hi,

There are some factors I think you can consider before choose the service to be used. One of example, number of expected traffic , traffic pattern, scaleability and security. You can consider some of services combination:

In high level overview with assumption you will handle huge write and read traffic:

  • Api management (for security, canary deployment) + Load balancing (service to distribute traffic) + compute layer (to run Postgrest).
  • For Api management you can use = API Gateway
  • For Load balancing you can use = ALB
  • For compute layer you can use = EC2+auto scaling group, EKS, or Lambda. Since i read that Postgrest has docker official image also = https://hub.docker.com/r/postgrest/postgrest/.
  • For caching you can use = ElasticCache
  • For message queing you can use = SQS
  • For security protection such as to handle from SQL injection can use = AWS WAF integrated with Api gateway or ALB
  • For connection pooling you can use = RDS Proxy

Sample solution combination can be like this:

  1. Api gateway + ALB + EC2 and auto-scaling group
  2. API gateway + ALB + EKS with Karpenter
  3. Api gateway + ALB + Lambda

Please read this reference to help you decide if you want to choose serverless or kubernetes: https://aws.amazon.com/architecture/serverless/serverless-or-kubernetes/.

Then, for frequent data which required sub mili latency you can enable caching to some API endpoint Api gateway + Elastic cache. And you can also consider to push some write request into SQS for queue before handling it to Postgrest. For security you can integrate AWS WAF to protect api gateway or ALB. And finally to improve your api you can consider use RDS Proxy to help with connectoin pooling (multiplexing) management.

Please alo do due diligence of above services and feature availability in your region: https://aws.amazon.com/about-aws/global-infrastructure/regional-product-services/

Thank you hope it can give some insight for you.

profile pictureAWS
answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions