AWS Lambda permission denied while trying to use ffmpeg

I want to write a handler that responds to S3 put events to convert any avi files that are loaded into mp4. I do this in Java, in Eclipse, with an AWS toolkit plugin. For video conversion, I use ffmpeg with ffmpeg-cli-wrapper , and I provided a static (linux) binary ffmpeg in the source tree.

I found that when I load a function, the binary is placed in /var/task, but when I try to use the test function that I wrote, I get a "permission denied" error.

import net.bramp.ffmpeg.FFmpeg;

public class LambdaFunctionHandler implements RequestHandler<S3Event, String> {

    private static final String FFMPEG = "/var/task/ffmpeg";

    public String handleRequest(S3Event event, Context context) {

        try {
            FFmpeg ff = new FFmpeg(FFMPEG);
            System.out.println(ff.version());
        } catch (Exception e) {
            e.printStackTrace();
        }

        return "foo";
    }
}

And the first line of a stacktrace: java.io.IOException: Cannot run program "/var/task/ffmpeg": error=13, Permission denied.

? , , chmod 755 , .

+4
2

AWS Lambda Amazon Linux. . ( ) , Amazon Linux . chmod /var/task/. , :

  • ffmpeg /tmp
  • chmod 755 /tmp/ffmpeg
  • /tmp/ffmpeg

. .

+5

, ffmpeg . (node.js code)

0

All Articles