7

From what I could gather in AWS's documentation, Aurora MySQL supports invoking lambda functions as triggers: http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/AuroraMySQL.Integrating.Lambda.html

No such documentation for Postgres. Is there a way to call a lambda from a Postgres instance?

2

2 Answers 2

5

PostgreSQL on RDS:

If you are using PostgreSQL on RDS, then as of now it doesn't support invoking lambda function as triggers.

Amazon Aurora(PostgreSQL Compatibility):

As of now this also doesn't support invoking lambda function as triggers.

PostgreSQL on EC2:

But if you have setup PostgreSQL on EC2, then you use leverage PL/Python language to create your User Defined Functions and AWS Python SDK to invoke Lambda functions.

In the below links, checkout the section titled PostgreSQL setup , in which they have provided detailed steps to achieve the same.

AWS Blog Link: Set up a SQL-to-Lambda interface

GitHub Link: aws-lambda-rdbms-integration

Sign up to request clarification or add additional context in comments.

9 Comments

The question wasn't asking about standard PostgreSQL on RDS, it was asking about Amazon Aurora (PostgreSQL compatible) on RDS.
@MarkB: the first paragraph answers that question. The rest is simply a suggestion for a workaround
Does Amazon Aurora Postgres support lambda invocations now?
@Madeo do you have a link/reference that shows how to create a trigger and function to call a lambda function?
@DanielHair I am really sorry, but I was wrong. Unfortunately RDS for Postgres, for some unknown reason, does not allow you to run plpython extension, which basically makes impossible to issue a request to a lambda. You could perhaps use the plperl one, but since you cannot install any additional package you will have to work at lowest level of the user space. However I have found another solution, you can use the LISTEN NOTIFY, but you will need a process to listen at all time, this means you need to deploy an EC2 or a Fargate instance that listen 24/7 for updates on a notification channel.
|
4

Since December 2020 Aurora PostgreSQL supports Lambda invocations. Documentation can be found here.

2 Comments

I always get a timeout while trying to invoke a lambda from Postgres.
@RahulPatel probably did not set up VPC correctly. Timeout usually means - firewall.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.