bool = tempFile.createNewFile();
the above line of code throwing java.io.IOException: Read-only file system, we are trying to create a file in aws lambda function(java spring boot) but we could not create a file?
To make sure your file goes where you want in the Lambda environment you could create the file like:
File tempFile = File.createTempFile("tmp", null, new File("/tmp"));
However, this does not do exactly what createNewFile() does in that it will not check if a file of the same name already exists. If that is required (and I'd question that design in a Lambda environment) then this won't be a direct replacement.
EDIT
It sounds like you're just trying to create a file. So instead of a using createTempFile just use something like:
File newFile = new File("/tmp/rose.jpeg");
boolean created = newFile.createNewFile();