A Gurobi license file set up on an AWS EC2 instance will remain valid if the EC2 instance is stopped and restarted. However, a Gurobi license file may become invalid after the EC2 instance is terminated unless some additional configuration steps are taken.
Gurobi license files are tied to specific hardware and software components of the host machine. These components normally change when EC2 instances are terminated and relaunched.
For Linux instances
On Linux, a Gurobi license file depends on the primary network interface, which may change when starting a new AWS EC2 instance. To prevent this, assign an Elastic Network Interface (ENI) to the EC2 instance and bind the Gurobi license to this new network adapter. With an ENI, the license file will continue to work, since the network interface persists for the machine running Gurobi.
Assigning a license file to the primary ENI
To assign a Gurobi license file to an ENI attached as the primary network interface, perform the following steps:
- Create a new ENI.
- Attach the ENI to your EC2 instance, assigning the ENI as the primary network adapter.
- Start your EC2 instance.
- Log in to your account on the Gurobi website and navigate to Downloads & Licenses->Your Gurobi Licenses. Click the appropriate license ID, then follow the instructions to download the license file onto the EC2 instance using
Assigning a license key to a secondary ENI
Assigning a Gurobi license file to an ENI attached as a secondary network interface is a more complicated process because by default
grbgetkey only considers the primary network interface. It can be done by performing the following steps:
- Create a new ENI.
- Attach the ENI to your AWS EC2 instance, assigning the ENI as the secondary network adapter.
- Start your AWS EC2 instance.
- Determine the required machine information:
grbprobe adaptersto list all available network interfaces
grbprobe --adapter <eni> --output probe.txtreplacing
<eni>with the name of your ENI adapter from the previous command.
grbgetkey --input probe.txtto generate the license information based on the previously stored machine information.
In case you cannot run
grbgetkey because you cannot reach the Gurobi license server from the AWS machine, you need to enter the information collected in the
probe.txt file manually:
- Log in to your account on the Gurobi website and navigate to Downloads & Licenses->Your Gurobi Licenses. Click the appropriate license ID, then download the license file using the manual process at the bottom of the webpage:
- Copy the license file to the EC2 machine.
For Windows instances
On Windows, a Gurobi license file depends on the primary volume. For Windows, use an Elastic Block Store (EBS) volume as your primary volume (C:) to retain the validity of the license file.
Note: If you plan to change AWS instance types, it is recommended that you set up your license file on a machine with the largest number of cores that you plan to use (subject to the number of cores allowed by the license).