How can files be securely transferred from a MATLAB application to AWS S3 using sftp or other supported methods?

3 Ansichten (letzte 30 Tage)
I am going to transfer files from a local PC to AWS using SFTP. It is assumed that data communication with AWS should be performed via SSH, but your guidance to complete this would be appreciated. 

Akzeptierte Antwort

MathWorks Support Team
MathWorks Support Team am 28 Okt. 2025 um 0:00
For transferring files to AWS S3, the standard approach in MATLAB is to use commands such as copyfile or movefile, which leverage the AWS S3 API for secure file transfer. This method does not require SFTP, as communication security (encryption, etc.) is managed by AWS, typically using HTTPS (TLS). Detailed procedures are available in the official MATLAB documentation.
If there is a specific requirement to use SSH-based communication (sftp), AWS Transfer Family can be employed to expose an S3 bucket as an SFTP server. In this scenario, the IT department must configure the integration between AWS Transfer Family and the S3 bucket. Once set up, MATLAB’s SFTP function can be used to transfer files as with any standard sftp server, supporting authentication methods such as password or SSH key authentication. An example implementation using MATLAB’s sftp command is provided for reference.
endPoint = "<...>.amazonaws.com"; % Replace with information provided by your IT department
username = "<...>"; % Replace accordingly
startingFolder = "/<...>"; % Replace accordingly
publicKeyFile = "C:\Users\<...>\.ssh\id_rsa.pub"; % Adjust to your environment
privateKeyFile = "C:\Users\<...>\.ssh\id_rsa"; % Adjust to your environment
sftpObj = sftp(endPoint, username, ...
StartingFolder=startingFolder, ...
PublicKeyFile=publicKeyFile, ...
PrivateKeyFile=privateKeyFile);
dir(sftpObj) % List files in the S3 bucket
This example demonstrates how to connect to an SFTP-enabled S3 bucket using SSH key authentication from MATLAB. Please adjust the parameters to match your environment and the information provided by your IT department. 

Weitere Antworten (0)

Kategorien

Mehr zu File Operations finden Sie in Help Center und File Exchange

Tags

Noch keine Tags eingegeben.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by