A Gurobi license key file installed on an AWS EC2 instance will remain valid if the EC2 instance is simply stopped and restarted. However, without additional configuration, a Gurobi license key may become invalid after the EC2 instance is terminated.
Gurobi license keys are tied to specific hardware/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 key 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 key will continue to work, since the network interface persists for the machine running Gurobi.
To install a Gurobi license key tied to an ENI, 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 install the license on the EC2 instance using grbgetkey.
For Windows instances
On Windows, a Gurobi license key 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 key.
Note: If you plan to change AWS instance types, it is recommended to install your license key on a machine with the largest number of cores that you plan to use (subject to the number of cores allowed by the license).