Being a beginner with AWS and S3, i was trying to integrate to upload a Sample.txt file from my local sftp to s3 using apache camel
<route>
<from uri="sftp://testuser@localhost?password=test&delete=true" />
<setHeader name="CamelAwsS3Key">
<constant>test</constant>
</setHeader>
<to uri="aws-s3://myTestBucket?accessKey=******&secretKey=RAW(******)&deleteAfterWrite=false&region=AP_SOUTH_1" />
</route>
This works but the file always uploads with the name test and type is also not shown. Have tried multiple methods. Any suggestions would be helpful.
The issue has been resolved when passing a the key and using the filename provided by SFTP simple
<route>
<from uri="sftp://testuser@localhost?password=test&delete=true" />
<setHeader name="CamelAwsS3Key">
<simple>${in.header.camelFileName}</simple>
</setHeader>
<to uri="aws-s3://myTestBucket?accessKey=******&secretKey=RAW(******)&deleteAfterWrite=false&region=AP_SOUTH_1" />
</route>
Thanks to @gusto2 for the support.
Also, as an addition you can add to a specific folder the file on upload by changing ,
<simple>{foldername}/${in.header.camelFileName}</simple>