Non-native mysql clients such as pymysql perform much slower than the native mysql client. Here’s how to get the native client working with lambda (through serverless):
- Download layers.zip from this repo https://github.com/nonbeing/mysqlclient-python3-aws-lambda/tree/master/build_output
- Move it to <project_root>/layers/mysqlclient.zip
- Add this to serverless.yml:
layers:
mysqlclient:
name: list-lambda-${opt:stage}-mysqlclient
package: