aws-lambda
Is it possible to POST to the SQS url using the post body
This may not have been exactly what the designers of API Gateway had in mind, but given… the way the AWS Query APIs (as used by the SDKs) work on the wire for services like SQS — url-encoded key/value pairs in the standard application/x-www-form-urlencoded format, and the fact that the built-in body mapping template language … Read more
Allow AWS Lambda to access RDS Database
You can’t enable this via IP. First you will need to enable VPC access for the Lambda function, during which you will assign it a Security Group. Then, within the Security Group assigned to the RDS instance you will enable access for the Security Group assigned to the Lambda function.
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
“invalid ELF header” when using the nodejs “ref” module on AWS Lambda
This happens when you build on one architecture and then attempt to use the same built addon on a different architecture (or platform in some cases). According to this page, addons may have to be compiled against an Amazon Linux image on EC2 in order for the compiled addons to be usable on their Lambda … 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
Error “Read-only file system” in AWS Lambda when downloading a file from S3
Only /tmp seems to be writable in AWS Lambda. Therefore this would work: filepath=”/tmp/” + key References: https://aws.amazon.com/blogs/compute/choosing-between-aws-lambda-data-storage-options-in-web-apps https://docs.aws.amazon.com/lambda/latest/dg/gettingstarted-limits.html
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