I would like to offload some code to AWS Lambda that grabs a part of a screenshot of a URL and stores that in S3. It uses chromium-browser which in turn needs to run in xvfb on Ubuntu. I believe I can just download the Linux 64-bit version of chromium-browser and zip that up with my app. I'm not sure if I can do that with xvfb. Currently I use apt-get install xvfb, but I don't think you can do this in AWS Lambda?
Is there any way to use or install xvfb on AWS Lambda?
Yes, you can use Xvfb on aws lambda with a bit configuration. For a working example see https://github.com/nisaacson/aws-lambda-xvfb
To get this to work, you need Xvfb and xkbcomp compiled with some special configuration values. Then you will need to bundle some shared libraries with your lambda function...
Compile xorg-server with the following flags to get the Xvfb binary
./configure
--with-xkb-path=/var/task/xkb \
--with-xkb-output=/tmp \
--with-xkb-bin-directory=/var/task/bin
Compile xkbcomp with the following flags
./configure \
--prefix=/usr \
--with-xkb-config-root=/var/task/xkb
Compile xkeyboard-config with the following flags
./configure \
--prefix=/usr \
--with-xkb-base=/var/task/xkb
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With