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 grbgetkey.
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 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 hostname and host ID of the ENI.
- Hostname: Run
hostname
when logged in to the machine or assign a custom hostname - Host ID: These are the last eight hexadecimal digits of the MAC address. In the image below, the host ID is
8de5be82
:
- Hostname: Run
- 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).