How do cloud licenses work?
Instead of using long term licenses that require static hardware we use short-term leases which give the flexibility of moving the license between different machines or containers.
These leases are stored in a
ampl.lic file that is replaced every time the lease is renewed. Each lease lasts 5 minutes and it is automatically renewed.
In order to renew a lease, the current license file and a fingerprint are sent to one of our REST API endpoints hosted across multiple cloud providers such as AWS and Azure.
If everything is ok with the request, a new lease is returned in the response and AMPL.lic file is replaced. There is no automatic enforcement of license limits as we just log the renewal.
Even though this mechanism was designed with Docker containers in mind, it also works natively on Windows and macOS virtual and physical machines too. The only requirement is an internet connection.
Which information is collected?
The fingerprint information sent in each request includes among other details the following:
number of CPU cores on the underlying machine
number of CPU threads available (e.g., Docker containers may be running restricted to a subset of CPU threads)
With the information obtained in the fingerprint we are able to count for any given moment:
Total number of concurrent active leases
Total number of CPU threads available across all concurrent active leases
Total number of different underlying machines with concurrent active leases
Total number of CPU cores across all machines with concurrent active leases
What happens if the limits are exceeded?
If a license is exceeding its limitations for long periods of time users are then contacted to figure out what happened and eventually upgrade the license limits to the customer needs. Since we just log the lease request and each lease lasts 5 minutes, exceeding license limits for short-periods of time is expected for instance when containers are being created and destroyed quickly.
How to check the status of AMPL cloud services?
You can check the status of AMPL cloud services at https://status.ampl.com/.
How to use AMPL with Docker containers?
AMPL can be easily used on Docker containers:
# Use any image as base image with python installed
RUN python -m pip install amplpy --no-cache-dir # Install amplpy
RUN python -m amplpy.modules install highs gurobi --no-cache-dir # Install modules
# Environment variables for amplkey (only necessary for non-root containers)
ENV AMPLKEY_RUNTIME_DIR /tmp/ampl/
ENV AMPL_LICFILE /tmp/ampl/ampl.lic
We do not provide a base docker image as we give the user total freedom about which base image to use.
In this example, we use the image
python:3.9-slim-bullseye as base image.
In the example above we used a Python container, for other options see AMPL on Docker Containers.
How to add AMPL installation directory to PATH/Path?
On Linux, you can add the path to AMPL installation directory (e.g.,
"/opt/ampl.linux-intel64/") to the environment variable
You can add this line to
On macOS, you can add the path to AMPL installation directory (e.g.,
"/Users/username/bin/ampl.macos64/") to the environment variable
You can add this line to
On any python script you can add the path to AMPL installation directory to the environment variable
Path as follows:
os.environ["PATH"] += os.pathsep + "/complete/path/to/ampl/installation/directory/"
Note: on Windows you should replace