Cannot use Requests-Module on AWS Lambda

EDIT: On Oct-21-2019 Botocore removed the vendored version of requests: https://github.com/boto/botocore/pull/1829. EDIT 2: (March 10, 2020): The deprecation date for the Lambda service to bundle the requests module in the AWS SDK is now January 30, 2021. https://aws.amazon.com/blogs/compute/upcoming-changes-to-the-python-sdk-in-aws-lambda/ To use requests module, you can simply import requests from botocore.vendored. For example: from botocore.vendored import requests … Read more

How can I install GraphicsMagick or ImageMagick on AWS Lambda?

I spun up the latest aws linux and ran the commands below. yum -y install gcc-c++ libpng-devel libjpeg-devel libtiff-devel wget wget https://downloads.sourceforge.net/project/graphicsmagick/graphicsmagick/1.3.26/GraphicsMagick-1.3.26.tar.gz tar zxvf GraphicsMagick-1.3.26.tar.gz cd GraphicsMagick-1.3.26 ./configure –prefix=/var/task/graphicsmagick –enable-shared=no –enable-static=yes make sudo make install tar zcvf ~/graphicsmagick.tgz /var/task/graphicsmagick/ I scp the dir down into my local and threw it in the package to be … Read more

Is it possible to trigger a lambda on creation from CloudFormation template

Yes, it is possible. Here are a few options: Manually create an SNS Topic. Add an AWS::SNS::Subscription to your stack with the lambda function as the Endpoint and the SNS topic as the TopicArn. On stack creation/update, configure Stack Event Notifications to be sent to this SNS topic. (See Setting AWS CloudFormation Stack Options for … Read more

Getting json body in aws Lambda via API gateway

There are two different Lambda integrations you can configure in API Gateway: Lambda non-proxy integration (docs), also called Lambda custom integration Lambda proxy integration (docs) For Lambda non-proxy integration, you can customise what you are going to pass to Lambda in the payload that you don’t need to parse the body, but when you are … Read more

Using psycopg2 with Lambda to Update Redshift (Python)

In order for this to work you need to build psycopg2 with statically linked libpq.so library. Check out this repo https://github.com/jkehler/awslambda-psycopg2. It has already build psycopg2 package and instructions how to build it yourself. Back to your questions: What is causing this problem? psycopg2 needs to be build an compiled with statically linked libraries for … Read more