I am facing an issue in aws s3 csv upload. The files i am uploading is not that huge has max size of 10mb or less atleast for now
The upload is success but some data is getting truncated( very few like 10 rows) In this case the csv size is 3515kb and when uploaded changed to 3512kb
I was using java sdk 1 from com.amazonaws earlier and when faced this issue i checked documentation and found a latest version and started to use java sdk 2 from software.amazon.awssdk.
In both cases i am facing the data truncation exactly to say the last line in csv is cut in middle
Have any one of you have faced this issue earlier.
The code block i tried is
public void uploadToS3(File file, String s3Key) throws FileNotFoundException {
Region region = "";
String accessKey = "";
String secretKey = "";
String bucketName = "";
AwsCredentials credentials = AwsBasicCredentials.create(accessKey, secretKey);
S3Client s3Client = S3Client.builder().credentialsProvider(StaticCredentialsProvider.create(credentials)).region(region).build();
PutObjectRequest request = PutObjectRequest.builder()
.bucket(bucketName)
.key(s3Key)
.build();
s3Client.putObject(request, RequestBody.fromFile(file));
s3Client.close();
}`