I am trying to upload files into my S3 bucket
using AWS Lambda
in Java and i'm having some issues.
I am using APIGatewayProxyRequestEvent
in my AWS Lambda
function to get my file upload from Postman
.
request.getBody()
method of this event gives me a String representation of the image file whereas the S3.putObject
takes as input an InputStream of the file to be uploaded.
How can I feed in request.getBody()
to the S3.putObject()
method in my Lambda code to make the File Upload work?
1) You may create a File and using FileWriter you may write the request.getBody() into it. 2) You can go with PutObjectRequest object and put file created in Step1 into it. 3) s3Client.putObject(PutObjectRequest) will help you to put object to s3
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.