Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Too difficult to implement in AWS Lambda as a Layer #88

Open
codepinto opened this issue Sep 22, 2024 · 1 comment
Open

Too difficult to implement in AWS Lambda as a Layer #88

codepinto opened this issue Sep 22, 2024 · 1 comment

Comments

@codepinto
Copy link

I recently implemented psycopg3 in my AWS Lambda function as a Layer to successfully query my AWS RDS database. What made this process manageable was the abundance of additional documentation for psycopg3—both from official sources and community-driven content (e.g., forum posts, videos). This was invaluable for understanding how to make it work in this specific environment.

However, I believe psqlpy has the potential to surpass psycopg3 in terms of usability and market adoption, particularly for AWS Lambda use cases. With a few targeted improvements, you could make psqlpy much easier for end users to integrate into AWS Lambda environments.

Suggestions:
Improve AWS Lambda compatibility: Simplifying the process for using psqlpy as an AWS Lambda Layer would be a significant advantage.

Reasons:

  1. Even the current solutions (e.g., psycopg3) lack sufficient documentation for Lambda integration, which leaves users spending unnecessary time troubleshooting. By addressing this, psqlpy could easily capture a larger user base.

  2. This is an easy-to-implement improvement ("low-hanging fruit") that would open the door to greater adoption, especially as AWS Lambda is such a widely-used service.

Next Steps:

  1. Create streamlined instructions for AWS Lambda integration: Provide clear, step-by-step documentation or a guide on how to download and structure psqlpy for AWS Lambda Layers.

  2. Provide a command or script for packaging psqlpy: An example of a command I used for psycopg3 that sets up the correct directory structure for Lambda is below. This makes it easy to generate a zip file and upload it to AWS as a Layer:

mkdir python\lib\python3.12\site-packages
pip install --platform manylinux2014_x86_64 --target=python/lib/python3.12/site-packages --implementation cp --python-version 3.12 --only-binary=:all: --upgrade "psycopg[binary]"
zip -r9 lambda_function.zip python
  1. Provide an AWS Lambda example: A sample Lambda function using psqlpy to query a database would be incredibly useful. AWS requires the main file to be named lambda_function.py and the function inside to be named lambda_handler. Having a working example would save developers significant time during setup.

By implementing these suggestions, I believe psqlpy could achieve much greater adoption, particularly within the AWS Lambda ecosystem.

I hope these suggestions help, and I’m happy to discuss further if needed. I look forward to supporting this project as it continues to evolve.

@chandr-andr
Copy link
Member

Thank you very much!
I'll try to figure out how to run PSQLPy on AWS Lambda and make normal guide.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants