These are examples of creating and deleting reference architectures for three MathWorks offerings; MATLAB, MATLAB Parallel Server and Network License Manager for MATLAB. There are examples for both AWS and Azure.
In each of the examples, the minimum parameters are supplied. The values for each parameter are specific to your AWS account and the deployment you with to create, so they should be set by the user. The documentation (linked to from each of the examples) goes into details of all possible parameters and their purpose.
From R2019b and after, each template supports multiple regions. So this can be used in any region that we support.
These examples use the AWS CLI and are written in bash.
For MATLAB on Amazon Web Services reference architecture.
AWS_REGION="us-east-1"
TEMPLATE_URL="https://s3.amazonaws.com/matlab-on-aws/aws-matlab-2019b-template.json"
STACK_NAME="stackname"
SSH_KEY="key-pair-name"
VPC="vpc-00000000"
SUBNET="subnet-00000000"
CLIENT_CIDR="0.0.0.0/32"
USERNAME="username"
PASSWORD="password"
# Create stack
aws cloudformation create-stack \
--region ${AWS_REGION} \
--stack-name ${STACK_NAME} \
--template-url ${TEMPLATE_URL} \
--capabilities CAPABILITY_IAM \
--parameters \
ParameterKey=SSHKeyName,ParameterValue=${SSH_KEY} \
ParameterKey=VPC,ParameterValue=${VPC} \
ParameterKey=SubnetA,ParameterValue=${SUBNET} \
ParameterKey=ClientIPAddress,ParameterValue=${CLIENT_CIDR} \
ParameterKey=Username,ParameterValue=${USERNAME} \
ParameterKey=Password,ParameterValue=${PASSWORD} \
ParameterKey=ConfirmPassword,ParameterValue=${PASSWORD}
# Delete stack
aws cloudformation delete-stack \
--stack-name ${STACK_NAME}
For MATLAB Parallel Server on Amazon Web Services reference architecture.
AWS_REGION="us-east-1"
TEMPLATE_URL="https://mdcs-on-aws.s3.amazonaws.com/R2019b/mjs-cluster-template.json"
STACK_NAME="stackname"
SSH_KEY="key-pair-name"
VPC="vpc-00000000"
SUBNETS="\"subnet-00000000,subnet-11111111,subnet-22222222,subnet-33333333,subnet-44444444,subnet-55555555\""
CLIENT_CIDR="0.0.0.0/32"
WORKER_INSTANCE_TYPE="g3s.xlarge"
CLUSTER_NAME="clustername"
# Create stack
aws cloudformation create-stack \
--region ${AWS_REGION} \
--stack-name ${STACK_NAME} \
--template-url ${TEMPLATE_URL} \
--capabilities CAPABILITY_IAM \
--parameters \
ParameterKey=SSHKeyName,ParameterValue=${SSH_KEY} \
ParameterKey=VPC,ParameterValue=${VPC} \
ParameterKey=Subnets,ParameterValue=${SUBNETS} \
ParameterKey=ClientIPAddress,ParameterValue=${CLIENT_CIDR} \
ParameterKey=WorkerInstanceType,ParameterValue=${WORKER_INSTANCE_TYPE} \
ParameterKey=ClusterName,ParameterValue=${CLUSTER_NAME}
# Delete stack
aws cloudformation delete-stack \
--stack-name ${STACK_NAME}
For Network License Manager for MATLAB on Amazon Web Services reference architecture.
AWS_REGION="us-east-1"
TEMPLATE_URL="https://network-license-manager-for-matlab-on-aws.s3.amazonaws.com/R2019b/license-manager-template.json"
STACK_NAME="stackname"
SSH_KEY="key-pair-name"
VPC="vpc-00000000"
SUBNET="subnet-00000000"
CLIENT_CIDR="0.0.0.0/32"
PASSWORD="password"
# Create stack
aws cloudformation create-stack \
--region ${AWS_REGION} \
--stack-name ${STACK_NAME} \
--template-url ${TEMPLATE_URL} \
--parameters \
ParameterKey=SSHKeyName,ParameterValue=${SSH_KEY} \
ParameterKey=VPC,ParameterValue=${VPC} \
ParameterKey=Subnet,ParameterValue=${SUBNET} \
ParameterKey=ClientIPAddress,ParameterValue=${CLIENT_CIDR} \
ParameterKey=Password,ParameterValue=${PASSWORD} \
ParameterKey=ConfirmPassword,ParameterValue=${PASSWORD}
# Delete stack
aws cloudformation delete-stack \
--stack-name ${STACK_NAME}
These examples use the Azure CLI and are written in PowerShell.
For MATLAB on Azure reference architecture.
$templateUri = 'https://raw.githubusercontent.com/mathworks-ref-arch/matlab-on-azure/master/releases/R2019b/azuredeploy-R2019b.json'
$userName = 'username'
$userPassword = 'ComplexPassword1@'
$clientCidr = '0.0.0.0/32'
$resourceGroupName = 'resourcegroup'
$location= 'East US'
$deploymentName = 'deploymentname'
# Create deployment
$secureAdminPassword=ConvertTo-SecureString "$userPassword" –asplaintext –force
New-AzResourceGroup -Name $resourceGroupName -Location $location
New-AzResourceGroupDeployment `
-Name $deploymentName `
-ResourceGroupName $resourceGroupName `
-TemplateUri $templateUri `
-clientIpAddress "$clientCidr" `
-userName "$userName" `
-userPassword $secureAdminPassword
# Delete deployment
Remove-AzResourceGroup -Name $resourceGroupName -Force
For MATLAB Parallel Server on Azure reference architecture.
$templateUri = 'https://raw.githubusercontent.com/mathworks-ref-arch/matlab-parallel-server-on-azure/master/releases/R2019b/azuredeploy-R2019b.json'
$clusterName = 'clustername'
$adminUsername = 'username'
$adminPassword = 'ComplexPassword1@'
$clientCidr = '0.0.0.0/32'
$resourceGroupName = 'resourcegroup'
$location= 'East US'
$workerInstanceType = 'Standard_D4s_v3'
$deploymentName = 'deploymentname'
# Create deployment
$secureAdminPassword=ConvertTo-SecureString "$adminPassword" –asplaintext –force
New-AzResourceGroup -Name $resourceGroupName -Location $location
New-AzResourceGroupDeployment `
-Name $deploymentName `
-ResourceGroupName $resourceGroupName `
-TemplateUri $templateUri `
-clientIpAddress "$clientCidr" `
-adminUsername "$adminUsername" `
-adminPassword $secureAdminPassword `
-clusterName "$clusterName" `
-workerInstanceType "$workerInstanceType"
# Delete deployment
Remove-AzResourceGroup -Name $resourceGroupName -Force
For Network License Manager for MATLAB on Azure reference architecture.
$templateUri = 'https://raw.githubusercontent.com/mathworks-ref-arch/license-manager-for-matlab-on-azure/master/releases/R2019b/azuredeploy-R2019b.json'
$adminUsername = 'username'
$adminPassword = 'ComplexPassword1@'
$clientCidr = '0.0.0.0/32'
$resourceGroupName = 'resourcegroup'
$location= 'East US'
$instanceType = 'Standard_D2s_v3'
$deploymentName = 'deploymentname'
# Create Deployment
$secureAdminPassword=ConvertTo-SecureString "$adminPassword" –asplaintext –force
New-AzResourceGroup -Name $resourceGroupName -Location $location
New-AzResourceGroupDeployment `
-Name $deploymentName `
-ResourceGroupName $resourceGroupName `
-TemplateUri $templateUri `
-clientIpAddress "$clientCidr" `
-adminUsername "$adminUsername" `
-adminPassword $secureAdminPassword `
-instanceType "$instanceType"
# Delete deployment
Remove-AzResourceGroup -Name $resourceGroupName -Force