How to read a file in AWS Lambda Function written in Java ?

前端 未结 4 473
庸人自扰
庸人自扰 2021-02-04 15:24

I have written an AWS Lambda Handler as below :

package com.lambda;
import com.amazonaws.services.lambda.runtime.Context;
import com.amazonaws.services.lambda.r         


        
4条回答
  •  醉梦人生
    2021-02-04 15:59

    If the file is located under resources folder, you can use it directly in lambda by using something like the following code:

    final BufferedReader br = new BufferedReader(new FileReader("/flows/cancellation/MessageArray.json"));
    

    I wanted to read a json file, you can have different use case, but the code works.

提交回复
热议问题