AWS Lambda 関数では、実行に必要なプログラムをZIPでパッケージ化します。 AWS Lambda PythonからRDS PostgreSQL に接続する場合はどうでしょうか? PostgreSQLアダプターのpsycopg2をビルドしてLambda関数のルートディレクトリに同梱するだけで済みそうですが、話はそう簡単ではありません。 libpqをpsycopg2に動的リンクさせた場合の弊害 psycopg2 はPostgreSQLクライアント用Cインターフェース libpq のラッパーであり、標準では libpq を動的リンクします。 残念なことに、AWS Lambda の実行環境では libpq は共有ライブラリとしてインストールされていないため、libpq を動的リンクしていると libpq が見つからず、以下のようなエラーが発生します。 Unable to import m