Skip to content
MATLAB interface for AWS S3.
MATLAB Java
Branch: master
Clone or download
Arvind Hosagrahara
Latest commit 303dbf2 Dec 12, 2019

README.md

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.

Requirements

MathWorks products

3rd party products

  • Amazon Web Services account

To build a required JAR file:

Getting Started

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.

Supported Products:

  1. MATLAB (R2017a or later)
  2. MATLAB Compiler™ and MATLAB Compiler SDK™ (R2017a or later)
  3. MATLAB Production Server™ (R2017a or later)
  4. MATLAB Distributed Computing Server™ (R2017a or later)

License

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.

Enhancement Request

Provide suggestions for additional features or capabilities using the following link:
https://www.mathworks.com/products/reference-architectures/request-new-reference-architectures.html

Support

Email: mwlab@mathworks.com or please log an issue.

You can’t perform that action at this time.