[Public] Deploying IronPDF in AWS Lambda: Understanding CustomDeploymentDirectory Behavior
Role of CustomDeploymentDirectory in Deployments
Summary
When deploying IronPDF in an AWS Lambda function using Docker, developers may attempt to use a temporary directory like /tmp
as a CustomDeploymentDirectory
. However, this can result in misleading log messages or failed native binary lookups — even though the PDF rendering process still works.
This article clarifies:
-
The role of
CustomDeploymentDirectory
-
Why using
/tmp
may not behave as expected -
When you actually need to set it
-
Recommended workarounds and best practices
Issue Description
When setting IronPdf.Installation.CustomDeploymentDirectory = "/tmp"
in AWS Lambda, IronPDF logs the following:
Attempting deployment for 'Pdfium' using '/tmp/'
Failed to locate assembly(s) for deployment '/tmp/' at path '/tmp/'
Successfully located 'IronPdfInterop' at '/var/task'
This may look like an error, but PDF rendering still proceeds normally — IronPDF simply falls back to using the default working directory (/var/task
) where the binaries are already available.
Why This Happens
-
CustomDeploymentDirectory
serves two purposes:-
A directory to download and deploy native components (e.g.,
IronPdf.Native.Chrome.Linux
) -
An alternative lookup path for runtime dependencies if not found in standard locations
-
-
IronPDF prefers already-deployed assemblies and only falls back to the custom path if necessary
-
In AWS Lambda, your Docker container's working directory is often already set to
/var/task
, where all required binaries reside
Hence, setting /tmp
as a custom path is unnecessary unless you're using IronPdf.Slim deployments or relying on runtime NuGet downloads of the binaries.
Recommended Configuration
For most AWS Lambda + Docker deployments with IronPdf.Linux, the simplest and most reliable setup is:
IronPdf.Installation.AutomaticallyDownloadNativeBinaries = false;
IronPdf.Installation.LinuxAndDockerDependenciesAutoConfig = false;
IronPdf.Installation.ChromeGpuMode = IronPdf.Engines.Chrome.ChromeGpuModes.Disabled;
IronPdf.Installation.SingleProcess = true;
var awsTmpPath = @"/tmp/"; // AWS temporary storage path
// Configuration for IronPDF rendering
IronPdf.Installation.ChromeGpuMode = IronPdf.Engines.Chrome.ChromeGpuModes.Disabled;
IronPdf.Installation.DefaultRenderingEngine = IronPdf.Rendering.PdfRenderingEngine.Chrome;
Environment.SetEnvironmentVariable("TEMP", awsTmpPath, EnvironmentVariableTarget.Process);
Environment.SetEnvironmentVariable("TMP", awsTmpPath, EnvironmentVariableTarget.Process);
IronPdf.Installation.TempFolderPath = awsTmpPath;
IronPdf.Installation.CustomDeploymentDirectory = awsTmpPath;
IronPdf.Installation.LinuxAndDockerDependenciesAutoConfig = true;
🚫 When Not to Use CustomDeploymentDirectory
You do not need to set CustomDeploymentDirectory
if:
-
You are using IronPDF dependencies (e.g.,
IronPdf.Linux
) during packaging of your project -
You're using full deployments and not downloading binaries at runtime
-
The Lambda function can access everything from
/var/task
(default behavior)
✅ When You Should Use It
You should consider using CustomDeploymentDirectory = "/tmp"
only if:
-
You're using
IronPdf.Slim
without native binaries -
You rely on runtime NuGet downloads for components like
IronPdf.Native.Chrome.Linux
-
You want to store temporary deployments in the only writable AWS Lambda directory (
/tmp
)
Key Takeaways
Key Point | Summary |
---|---|
CustomDeploymentDirectory |
Use only when runtime download is required (e.g., with IronPdf.Slim ) |
Writable Directory in Lambda | Only /tmp is writable — but not needed for runtime dependencies if you deploy them |
Default Path | IronPDF defaults to /var/task for looking up assemblies |
Logging | Fallback logs are informational, not errors |