MATLAB® Interface for AWS S3™
This is a MATLAB® interface for the Amazon Web Services S3™ service. This is a low-level, general interface that can be customized if the higher-level interface as provided in MATLAB does not support your needs. see here https://www.mathworks.com/help/matlab/import_export/work-with-remote-data.html for more details on what is provided in MATLAB.
- Requires MATLAB release R2017a or later.
- AWS Common utilities found at https://github.com/mathworks-ref-arch/matlab-aws-common
3rd party products
- Amazon Web Services account
To build a required JAR file:
Please refer to the Documentation to get started. The Installation Instructions and Getting Started documents provide detailed instructions on setting up and using the interface. The easiest way to fetch this repo and all required dependencies is to clone the top-level repository using:
git clone --recursive https://github.com/mathworks-ref-arch/mathworks-aws-support.git
Build the AWS SDK for Java components
The MATLAB code uses the AWS SDK for Java and can be built using:
cd Software/Java mvn clean package
Once built, use the
/Software/MATLAB/startup.m function to initialize the interface which will use the
AWS Credentials Provider Chain to authenticate. Please see the relevant documentation
on how to specify the credentials.
Create a bucket, list existing buckets, upload and download objects
%% Create and initialize a client s3 = aws.s3.Client(); s3.initialize(); %% Create a test bucket bucketName = 'com-myorg-my-test-bucket'; s3.createBucket(bucketName); %% List existing buckets bucketList = s3.listBuckets() %% Upload a file % Create some random data x = rand(100,100); % Save the data to a file uploadfile = [tempname,'.mat']; save(uploadfile, 'x'); % Put the .MAT file into an S3 object called 'myobjectkey' in the bucket s3.putObject(bucketName, uploadfile, 'myobjectkey'); % Download a file s3.getObject(bucketName,'myobjectkey','download.mat'); % Delete a object and then the bucket s3.deleteObject(bucketName,'myobjectkey'); s3.deleteBucket(bucketName); % Delete the client s3.shutdown;
The interface supports a number of S3 features including credential-free authentication using IAM when running on EC2™. Please consult the documentation for more details.
- MATLAB (R2017a or later)
- MATLAB Compiler™ and MATLAB Compiler SDK™ (R2017a or later)
- MATLAB Production Server™ (R2017a or later)
- MATLAB Distributed Computing Server™ (R2017a or later)
The license for the MATLAB Interface for AWS S3 is available in the LICENSE.TXT file in this GitHub repository. This package uses certain third-party content which is licensed under separate license agreements. See the pom.xml file for third-party software downloaded at build time.
Provide suggestions for additional features or capabilities using the following link:
email@example.com or please log an issue.