Sharing MATLAB applications on AWS using the MATLAB Web App Server
If you are a researcher or scientist, you may be familiar with MATLAB, a computational analysis tool produced by Mathworks. And if you work in higher education, you may work with individuals and groups outside of your organization for data collection or the analysis of that data. Learn how to extend the reach of MATLAB applications on Amazon Web Services (AWS) by using the MATLAB Web App Server.
Collecting your data
MATLAB is used in research studies with human subjects to collect data and take psychophysical measurements, such as response times, pattern recognition, or similar data points. If the participant can come to a lab, recording the data is simple. But what if you want to include subjects on the other side of the world? And with COVID-19 changing the way we interact, researchers now need a way to collect their data without face-to-face contact.
The algorithms codified in your MATLAB application may be proprietary or even a trade secret. You may need to allow study participants or external research colleagues to use your application without relinquishing control of it. For example, they could remotely upload and analyze data without gaining access to the application itself.
Sharing your applications
The MATLAB Web App Server allows you to publish your application as a web application and host it on a server running in AWS. Using one or more Amazon Elastic Compute Cloud (Amazon EC2) instances, remote users can access MATLAB applications through a web browser. The remote user does not need to have MATLAB installed on their own device. The user enters the URL into their browser and then selects from the list of applications shown. The MATLAB application is then presented to the user much like any MATLAB application running on a traditional desktop, including the ability to use graphics and other input controls.
The size of the Amazon EC2 instance is dictated by the complexity of the MATLAB application, as well as the amount of simultaneous use expected. There are three components required to host an application. The first is the MATLAB Web App Server itself, which is supported on both Microsoft Windows and Linux operating systems. If a Linux operating system is deployed, a Graphical User Interface is also required during the installation of the MATLAB Web App Server. This component acts as the web server, brokering the user requests and displaying the available MATLAB applications.
The second component is a license. The MATLAB Web App Server is a separate product from the MATLAB desktop product and requires its own license. MATLAB licenses are assigned and managed with a licensing server. If only a single instance is required, the license server can be installed on the same Amazon EC2 instance as the MATLAB Web Application Server. However, if you have multiple MATLAB Web App Servers, you may have a centralized licensing server to service all of them. A license is tied to either the instance’s MAC address or its public IP address. If the server is frequently stopped or reconfigured, it may be prudent to use an Elastic IP address that does not change and can be reused as configuration changes are made to the instance.
The third required component is a MATLAB runtime. The MATLAB Web App Server uses this lightweight runtime to execute the compiled MATLAB applications. Different runtimes can be installed on the same instance, allowing the MATLAB Web App Server to host applications created by various versions and revisions of MATLAB.
Prepare your applications for the web
The MATLAB desktop product is required to compile an application for use on the MATLAB Web App Server. All dependencies from custom “toolboxes” that can be loaded into MATLAB are compiled into the binary. This allows a common runtime to support any application regardless of what toolboxes were used to create the application.
Amazon WorkSpaces can provide host for the MATLAB desktop product to compile your applications. The administrator then uploads the resulting compiled binary to the MATLAB Web App Server “apps” directory where it is immediately available for use. No restart of the MATLAB Web App Server or “loading” of the application is necessary. An optional file system could be shared between the MATLAB workstation and the MATLAB Web App Server to facilitate a simpler exchange of data, log files and the compiled applications.
The MATLAB Web App Server can also directly read from and write to Amazon Simple Storage Service (Amazon S3).
For added security, the MATLAB Web Application Server can authenticate users via LDAP or OpenID Connect (OIDC). Roles can be defined by adding users to groups within your authentication source. Authors can have full rights to edit the applications, but users can be restricted to only running the applications.
Using another web server to act as a “portal” to the MATLAB Web App Server can help if the study is collecting data from human subjects. In addition to authentication, consent to collect personal data from the study participant may need to be collected prior to participation, or other notices or documentation may need to be provided to the subject.
MATLAB Web Application Server running on Amazon EC2 provides researchers with a way to share their efforts with a broader audience. For assistance getting started, contact us. Learn more about research and technical computing on AWS.