Main Content

Manage AWS Resources for MATLAB Production Server (PAYG)

After you deploy the MATLAB® Production Server™ pay as you go (PAYG) 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.

  1. Log in to the AWS management console and select the CloudFormation stack associated with the deployment.

  2. Select the Outputs tab from the top pane.

  3. Click the link corresponding to MATLABProductionServerAutoScalingGroup. Doing so opens a new window that lets you manage auto scaling groups.

  4. 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

When you deploy MATLAB Production Server (PAYG), you get two HTTPS endpoint URLs. One endpoint lets you connect to the server instances and the other to the dashboard. To use HTTPS, you must upload an SSL certificate to the load balancer from the AWS certificate manager. For information on creating a self-signed SSL certificate, see Create and sign an X509 certificate.

  1. Open the AWS certificate manager.

  2. Click Import a Certificate.

  3. Copy the contents of the CRT file containing the certificate into the field labeled Certificate body.

  4. Copy the contents of the PEM file containing the private key into the field labeled Certificate private key.

  5. Leave the filed labeled Certificate chain blank and click Next.

  6. Click Review and Import.

  7. Review the values and click Import.

  8. 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 (PAYG), 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.

  1. Log in to the AWS management console and select the CloudFormation stack associated with the deployment.

  2. Select the Outputs tab from the top pane.

  3. To change the X.509 certificate for the server instances, click the link corresponding to MATLABProductionServerLoadBalancer key.

  4. To change the X.509 certificate for the dashboard, click the link corresponding to MATLABProductionServerDashboardLoadBalancer key.

  5. Select the Listeners tab, the click Change under SSL Certificate.

For more information, see Replace the SSL certificate for your Classic Load Balancer.

View Logs

View MATLAB Production Server logs using AWS CloudWatch .

  1. Log in to the AWS management console and select the CloudFormation stack associated with the deployment.

  2. Select the Outputs tab from the top pane.

  3. Click the link corresponding to MATLABProductionServerWorkerVMLogGroup. Doing so opens a new CloudWatch window that displays details for the MATLABProductionServerWorkerVMLogGroup.

  4. 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.

  1. In the AWS management console, select the stack that you deployed. You can find the stack under the CloudFormation service.

  2. In the stack detail pane, expand the Outputs section.

  3. Look for the key named MATLABProductionServerLoadBalancer and click the corresponding URL listed under value to configure the load balancer.

  4. Click Edit idle timeout under the Attributes section.

  5. 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.

  1. Log in to the AWS management console and select the stack associated with the deployment. You can find the stack in the CloudFormation service.

  2. 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.

Related Topics