1

I need to run wdiff from a JAR file. Locally, I do this by invoking a process that runs either the wdiff binary manually installed on a Linux server or a wdiff.exe located in a convenient nearby folder on Windows.

Now, I need to deploy to AWS Lambda, and can't rely on wdiff (or its dependency, diff) to be installed. So how can I get wdiff to run on Lambda?

I guess there are two possible questions/solutions here:

  1. Is it possible to include a third-party binary on the AWS Lambda container?
  2. Is it possible to bundle an executable binary inside a JAR file and execute it from code?

1 Answer 1

3

Create a Lambda layer with the binary you need. You can get /usr/bin/wdiff from a runtime similar to the AWS Lambda one. In your case almost any linux would be fine. If diff of any other dependencies are not installed, put then into the same layer.

Then you can call the binary inside the jar as a usual external program, for example with ProcessBuilder

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks, worked perfectly! Looks like diff is preinstalled so just adding wdiff was enough.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.