Building an AMI

Starting with Gurobi 8.0, we have greatly simplified the process to create a custom AMI running the Gurobi Remote Services, and we will no longer provide predefined AMIs. This will give you more flexibility to start your servers in any AWS data center around the world. Also, you will be able to select and maintain the operating system. At the time of writing this guide, we recommend using the latest ubuntu 18.04 LTS AMI (we will assume such a choice in the following instructions).

Building an AMI manually

In order to create manually the AMI, please follow these steps, you should be very familiar with EC2:

  1. Launch an EC2 instance:
    • Select the latest ubuntu 18.04 LTS AMI base AMI from the Community. You may want to search available AMIs with the base name ubuntu/images/hvm-ssd/ubuntu-bionic-18.04-amd64-server-2018 or refer to the ubuntu image locator
    • Select the t2.micro instance type, there is no need to select a larger instance to create the image.
    • Make sure to setup a security group that is allowing SSH on port 22.
    • Assign a key so that you will be able to log in to the instance (we will call it key.pem).
    • Wait for the instance to be running and lookup the instance public DNS name (we will call it ec2-instance)
  2. Copy the server package to your instance:
    scp -i key.pem gurobi_server903_linux64.tar.gz ubuntu@ec2-instance:/tmp/
  3. Log in to your instance:
    ssh -i key.pem ubuntu@ec2-instance
  4. Unpack the server package:
    sudo tar xfz /tmp/gurobi_server903_linux64.tar.gz -C /opt/
  5. Replace the configuration file with the predefined AWS configuration:
    sudo cp /opt/gurobi_server903/linux64/bin/grb_rs_aws.cnf /opt/gurobi_server903/linux64/bin/grb_rs.cnf
    Alternatively, you can copy a configuration file that you prepared in advance.
  6. Review and update the configuration file as necessary (optional):
    sudo vi /opt/gurobi_server903/linux64/bin/grb_rs.cnf
  7. Start the Remote Services:
    sudo /opt/gurobi_server903/linux64/bin/grb_rs start
  8. Verify the log. The log messages are automatically forwarded to the syslog and also to service.log rotating file:
    tail -f /opt/gurobi_server903/linux64/bin/service.log
            
    The log file should indicate that the server started. Disregard the message about the license being invalid, unless you modified the configuration file with a CLOUDKEY. However, make sure that there is no errors about the configuration file and properties. Here is a sample of the expected output:
    ...
    2018-03-01T17:20:46Z - info  : Starting API server (HTTP) on port 80...
            
  9. Log out of the instance
  10. Select the instance in the EC2 dashboard and run the action Image/Create Image, then wait for your image to be ready.
  11. Once the AMI is available, you can terminate the instance.

Building an AMI with Packer

You can easily automate the creation of the AMI using Packer. Here is a sample script provided as-is. You can easily extend it to copy a predefined configuration file, or to set up TLS encryption by copying your private key and certificate. With this script example, Packer will also select the latest ubuntu 18.04 base AMI for you. To use this script, please follow these steps:

  1. Install Packer
  2. Create a new directory
  3. Download the script gurobi-ami.json and save it in this new directory
  4. Download the server package gurobi_server903_linux64.tar.gz and save it in this new directory
  5. Run Packer from this directory and provide your AWS access key and secret on the command line:
        $ packer build \
        -var 'aws_access_key=YOUR ACCESS KEY' \
        -var 'aws_secret_key=YOUR SECRET KEY' \
        gurobi-ami.json
        

Try Gurobi for Free

Choose the evaluation license that fits you best, and start working with our Expert Team for technical guidance and support.

Evaluation License
Get a free, full-featured license of the Gurobi Optimizer to experience the performance, support, benchmarking and tuning services we provide as part of our product offering.
Academic License
Gurobi supports the teaching and use of optimization within academic institutions. We offer free, full-featured copies of Gurobi for use in class, and for research.
Cloud Trial

Request free trial hours, so you can see how quickly and easily a model can be solved on the cloud.

Search