Question: Can we get a file from S3 . using SuiteS...
# suitescript
n
Question: Can we get a file from S3 . using SuiteScript ? What do i need to get that. Secret KEy Bucket File name What else ?
👀 1
e
The most difficult part will be the authentication with AWS. The actual S3 API call is simple once you have authenticated. I feel like I've seen examples of this before but I don't do this myself so don't have one to share.
i
Haven't done from NS side to get from S3, but have done from S3 to NS. Would your files be more than 10MB that's always a limitation when working with the File Cabinet
n
Is there any app/plugin for AWS SDK to use in suiteScript?
e
Nothing that is supported by NetSuite. I'm sure there have been some developed open source.
a
maybe not exactly what you were asking for and my not help, but I remember someone telling me that you can easily turn an S3 bucket into essentially an SFTP server... if you have control over the AWS side to do that, it might be easier than figuring out the AWS Auth from the NS side.
you could probably also use an AWS lambda and have NS call into that - I think that would avoid having to do a full on Auth in NS... the lambda and the S3 bucket would already be connected with each other so you'd just need to call the lambda from NS I've not done that myself on AWS arch, but I did years ago on google cloud calling a google cloud function from NS and then having that hit google biq query to avoid doing the auth from NS
i
You can make S3 accessible through SFTP but the cost are pretty high. If you do have an existing SFTP server you can throw WinSCP on it which can connect to S3 and create a script that syncs up, essentially a middleware but an alternate option if you don't want to spend time with the Auth portion.
👍 1
m
This page has what appears to be an S3 library for NetSuite. I have not tried it yet but it's on my list to investigate.
a
thanks for the SFTP cost info, i wasn't sure on the cost, someone else was doing it made it seem like no big deal so I just assumed there wasn't a significant cost
s
I did modify the AWS SDK to work in NetSuite but that was quite a few years ago and just for the use case I cared about (which was S3 interaction). I presume it would still be possible unless the AWS SDK has evolved to something completely incompatible. I do recall some significant effort on my part to make it work.
n
Thanks For the reply everyone. I was able to modify and build the specific AWS SDK, instead of using the whole library. Then i built using nodejs on my local. Uploaded the built file in file cabinet and used in my script. I am able to successfully get the files from S3. As this is a bit tricky for the people like me, i will write a blog post for this to share publicly, which i think can save someone’s time. Thanks once again
👍 4
m
@NSN Would love to read it when you're done!