Manage AWS Resources for MATLAB Production Server
After you deploy the MATLAB® Production Server™ environment on AWS®, use the AWS management console to manage resources that you provision for in the deployment.
Change Number of Virtual Machines
Each MATLAB Production Server instance runs on a virtual machine (VM) and each instance runs multiple MATLAB Production Server workers. You can change the number of VMs after the initial deployment.
Log in to the AWS management console and select the CloudFormation stack associated with the deployment.
Select the Outputs tab from the top pane.
Click the link corresponding to MATLABProductionServerAutoScalingGroup. Doing so opens a new window that lets you manage auto scaling groups.
You can change the number of server VMs in this window. For information on how to do so, see Manual scaling for Amazon EC2 Auto Scaling.
Import SSL Certificate
The MATLAB Production Server deployment requires an SSL certificate present in your AWS account. When you deploy MATLAB Production Server, you get two HTTPS endpoint URLs. One endpoint lets you connect to the server instances and the other to the dashboard. For information on creating a self-signed SSL certificate, see Create and sign an X509 certificate.
Open the AWS certificate manager.
Click Import a Certificate.
Copy the contents of the CRT file containing the certificate into the field labeled Certificate body.
Copy the contents of the PEM file containing the private key into the field labeled Certificate private key.
Leave the field labeled Certificate chain blank and click Next.
Click Review and Import.
Review the values and click Import.
Copy the value of the ARN field from the Details section of the certificate and paste it into the ARN of SSL Certificate parameter during deployment.
Change SSL Certificate
When you deploy MATLAB Production Server, you get two HTTPS endpoint URLs. One endpoint lets you connect to the server instances and the other to the dashboard. You can change the X.509 certificates for these resources.
Log in to the AWS management console and select the CloudFormation stack associated with the deployment.
Select the Outputs tab from the top pane.
To change the X.509 certificate for the server instances, click the link corresponding to MATLABProductionServerLoadBalancer key.
To change the X.509 certificate for the dashboard, click the link corresponding to MATLABProductionServerDashboardLoadBalancer key.
Select the Listeners tab, the click Change under SSL Certificate.
For more information, see Replace the SSL certificate for your Classic Load Balancer.
Upload MATLAB Applications
The Amazon S3™ bucket lets you upload and deploy multiple applications to the server.
Log in to the AWS management console and select the CloudFormation stack associated with the deployment.
Select the Outputs tab from the top pane.
Click the link corresponding to MATLABProductionServerApplicationsBucket. Doing so opens a new window that displays details for the Amazon S3 bucket.
In the pane that opens, click the auto_deploy folder.
Select Upload to select the applications to upload, then click Upload.
View Logs
View MATLAB Production Server logs using AWS CloudWatch.
Log in to the AWS management console and select the CloudFormation stack associated with the deployment.
Select the Outputs tab from the top pane.
Click the link corresponding to MATLABProductionServerWorkerVMLogGroup. Doing so opens a new CloudWatch window that displays details for the
MATLABProductionServerWorkerVMLogGroup
.Select View in Logs Insights. Doing so opens a new Logs Insights console with an existing query. Ignore this default query.
To view logs generated by all the server instances, you can use the following query.
fields @timestamp, @message | filter @logStream like 'prodServerInstance' | limit 200
To view the last 200 logs generated by all server instances, you can use the following query.
fields @timestamp, @message | filter @logStream like 'prodServerInstance' | limit 200
To view only the error logs generated by all server instances, you can use the following query. For more information on log severity, see log-severity.
fields @timestamp, @message | filter @logStream like 'prodServerInstance' | filter severity like 'error'
To view logs generated by all the server instances within a certain time duration, you can use the custom range selector.
Handle Timeouts
If the deployed MATLAB function takes more than 120 seconds to finish execution, the client
application receives a 504 GATEWAY_TIMEOUT
error. This is because the
load balancer configuration closes a connection that is idle for more than 120 seconds. To
avoid the time out error, you can increase the load balancer timeout.
In the AWS management console, select the stack that you deployed. You can find the stack under the CloudFormation service.
In the stack detail pane, expand the Outputs section.
Look for the key named
MATLABProductionServerLoadBalancer
and click the corresponding URL listed under value to configure the load balancer.Click Edit idle timeout under the Attributes section.
Set the timeout value based on the time that your deployed functions require for execution.
Delete Stack
A stack contains all the related AWS resources for a solution. You can remove the stack and all the associated cluster resources when you no longer need them. You cannot undo this.
Log in to the AWS management console and select the stack associated with the deployment. You can find the stack in the CloudFormation service.
Click Delete.
If you do not want to delete the entire deployment but want to minimize the cost you can bring the number of instances in the Auto Scaling Group down to 0 and then scale it back up when the need arises.