In order to get Varnish running, you can provide an AMI or a list of packagesto install via user data. The AMI is specified via the ``AMI_ID`` environmentvariable, while the packages are specified by the ``API_PACKAGES`` environmentvariable. Users may specify both variables.

.. highlight: bash

::

% tsuru env-set AMI_ID=your-ami-id API_PACKAGES=varnish vim-nox

Users may also specify a subnet for running with VPC. You can specify thesubnet ID via the ``SUBNET_ID`` environment variable.

.. highlight: bash

::

% tsuru env-set SUBNET_ID=your-subnet-id

The API also needs a SSH key in order to comunicate with the service instances'VMs. You will need to store the key in the application machine and export theenvironment variable ``KEY_PATH``:

.. highlight: bash

::

% tsuru env-set KEY_PATH=/home/ubuntu/.ssh/id_rsa.pub

One more thing: this API will use MongoDB to store information about instances,the MongoDB endpoint and the database name is also controlled via environmentvariables:

We're done with our API! Let's create the service in Tsuru.

Creating the Service--------------------

First you'll have to change the ``manifest.yaml`` file located at the projectroot of our application. Change the production endpoint to point to theapplication address, your yaml should look like this:

.. highlight: yaml

::

id: varnish endpoint: production: varnishapi-endpoint.com

Now let's tell tsuru it needs to registrate a new service, from the projectroot run, using `crane<http: godoc.org="" github.com="" globocom="" tsuru="" cmd="" crane="">`_: