AWS Lambda / Amazon Linux 2

AWS Lambda / Amazon Linux 2 (Install as admin/root using IronPdf.Linux)

This information is also shown on our website -

AWS Instructions: 
1. See
2. Create and use the following dockerfile:

WORKDIR /var/task
RUN yum install -y pango.x86_64 
RUN yum install -y libXcomposite.x86_64 
RUN yum install -y libXcursor.x86_64
RUN yum install -y libXdamage.x86_64
RUN yum install -y libXext.x86_64 
RUN yum install -y libXi.x86_64 
RUN yum install -y libXtst.x86_64 
RUN yum install -y cups-libs.x86_64 
RUN yum install -y libXScrnSaver.x86_64 
RUN yum install -y libXrandr.x86_64
RUN yum install -y GConf2.x86_64 
RUN yum install -y alsa-lib.x86_64
RUN yum install -y atk.x86_64 
RUN yum install -y gtk3.x86_64 
RUN yum install -y ipa-gothic-fonts 
RUN yum install -y xorg-x11-fonts-100dpi
RUN yum install -y xorg-x11-fonts-75dpi
RUN yum install -y xorg-x11-utils
RUN yum install -y xorg-x11-fonts-cyrillic
RUN yum install -y xorg-x11-fonts-Type1 
RUN yum install -y xorg-x11-fonts-misc
RUN yum install -y glibc-devel.x86_64
RUN yum install -y at-spi2-atk.x86_64
RUN yum install -y mesa-libgbm.x86_64
# This COPY command copies the .NET Lambda project's build artifacts from the host machine into the image. 
# The source of the COPY should match where the .NET Lambda project publishes its build artifacts. If the Lambda function is being built 
# with the AWS .NET Lambda Tooling, the `--docker-host-build-output-dir` switch controls where the .NET Lambda project
# will be built. The .NET Lambda project templates default to having `--docker-host-build-output-dir`
# set in the aws-lambda-tools-defaults.json file to "bin/Release/lambda-publish".
# Alternatively Docker multi-stage build could be used to build the .NET Lambda project inside the image.
# For more information on this approach checkout the project's file.
COPY "bin/Release/lambda-publish".
3. Add IronPdf.Linux package to your solution

4. Modify  FunctionHandler code - this example will create a PDF from a webpage ( and save to /tmp . In order to view this PDF, it must be uploaded to another service, such as S3. (Official AWS example available here -

public Casing FunctionHandler(string input, ILambdaContext context)
                context.Logger.LogLine($"START FunctionHandler RequestId: {context.AwsRequestId} Input: {input}");

                var awsTmpPath = @"/tmp/"; // AWS temporary storage

                //[optional] enable logging (please uncomment these code if you face any problem)
                //IronPdf.Logging.Logger.EnableDebugging = true;
                //IronPdf.Logging.Logger.LogFilePath = awsTmpPath;
                //IronPdf.Logging.Logger.LoggingMode = IronPdf.Logging.Logger.LoggingModes.All;

                //set your license key
                IronPdf.License.LicenseKey = "YOUR_LICENSE_KEY";
                //set ChromeGpuMode to Disabled
                IronPdf.Installation.ChromeGpuMode = IronPdf.Engines.Chrome.ChromeGpuModes.Disabled;
                //set DefaultRenderingEngine to Chrome
                IronPdf.Installation.DefaultRenderingEngine = IronPdf.Rendering.PdfRenderingEngine.Chrome;
                //set IronPDF Temp Path
                Environment.SetEnvironmentVariable("TEMP", awsTmpPath, EnvironmentVariableTarget.Process);
                Environment.SetEnvironmentVariable("TMP", awsTmpPath, EnvironmentVariableTarget.Process);
                IronPdf.Installation.TempFolderPath = awsTmpPath;
                IronPdf.Installation.CustomDeploymentDirectory = awsTmpPath;
                //set auto LinuxAndDockerDependenciesAutoConfig
                IronPdf.Installation.LinuxAndDockerDependenciesAutoConfig = true;
                context.Logger.LogLine($"creating IronPdf.ChromePdfRenderer");
                var Renderer = new IronPdf.ChromePdfRenderer();
                context.Logger.LogLine($"rendering Pdf");
                using var pdfDoc = Renderer.RenderUrlAsPdf("");
                var guid = Guid.NewGuid();
                var fileName = $"/tmp/{input}_{guid}.pdf"; //save file to /tmp

                context.Logger.LogLine($"saving pdf name : {fileName}");
                //here you can upload saved pdf file to anywhere such as S3. 
            catch (Exception e)
                context.Logger.LogLine($"[ERROR] FunctionHandler : {e.Message}");
            return new Casing(input?.ToLower(), input?.ToUpper());
    public record Casing(string Lower, string Upper);

5. Increase memory and timeout - IronPDF requires more time and memory than the default value of Lambda. This can be configured at  aws-lambda-tools-defaults.json. Please adjust this to match you function. 

In this example. we set to 512 (mb) and 330 (seconds):

    "function-memory-size" : 512,
    "function-timeout"     : 330,
The configuration can also be updates using Lambda console -

6. Please follow the final part of the following documentation to publish and try a Lambda function

7. Lambda function can also be invoked using Lambda console, or invoked via visual studio by using the AWS Toolkit for Visual Studio -
If you receive a "GPU process isn't usable" message, installation may not have been run with admin privileges. Please try running the software again with admin/root privileges. Alternatively add the following to your docker file:
  • RUN chmod 755 "runtimes/linux-x64/native/IronCefSubprocess"