Getting started with Anbox Cloud

This guide provides the first steps to using Anbox Cloud. If you haven’t installed Anbox Cloud, please refer to the installation page first.

Configure Access Credentials for the Image Server

In order to access the Anbox Cloud images you have received credentials from Canonical you now
have to configure in your deployment:

$ juju ssh ams/0 -- amc config set images.auth <credentials>

Once the credentials are configured it will take a few minutes until all images are downloaded
and available for use.

Access to AMS

For all subsequent commands using the amc tool to work you need to access the ams/0 machine. You can do this by opening an SSH session with the juju command:

$ juju ssh ams/0

Afters you have the amc command available.

Alternatively you can also install the amc command on your Ubuntu based development machine. See AMS Access for more details.

Ensure Images are Available

As a next step you can check that AMS has synchronized all images from the Canonical hosted
image server. You can list all synchronized images with the following command:

$ amc image ls
| ID                   | NAME                        | STATUS | VERSIONS | DEFAULT |
| bpkam07d6hg5q3ihfglg | bionic:android7:amd64       | active | 1        | true    |
| bpkam2fd6hg5q3ihfgm0 | io.anbox-cloud:nougat:amd64 | active | 1        | false   |
| bpkam4nd6hg5q3ihfgmg | bionic:android10:amd64      | active | 1        | false   |

If the images are not yet available, wait a few more minutes.

Launch a container

If you simply want to get a raw container without any application for a specific Android version
you can do this via

$ amc launch -r bionic:android7:amd64

on ARM64 and with

$ amc launch -r bionic:android10:arm64

You can watch the container starting with

$ amc ls

Once it is up and running you can get a shell inside the container with

$ amc shell <container id>

See the Managing containers for more details.

Create an application

AMS provides functionality to manage Android applications for you. In order to let AMS
manage your application you need the APK of the application and a manifest.yaml which looks like this in its simplest form:

$ cat manifest.yaml
instance-type: a2.3

Hint: If you deployed Anbox Cloud with the streaming stack, use an instance type with GPU support like g2.3. Otherwise the container will not get access to a GPU for rendering and video

The manifest basically defines the name of the application and which instance type the application
should use as well as more advanced configuration like Addons, permissions and others . You can find more details about manifest format and the available instance types in the Application Management and Instance Types sections.

To create the application with ams, place the APK as app.apk in the same directory as the manifest.yaml, and run the following command:

$ amc application create /path/to/directory/with/apk/and/manifest/

AMS will now run through a bootstrap process for the application to allow for faster boot times of
the application later on.

You can monitor the progress of the application with

$ watch -n 1 amc application ls

When the application is marked as ready you just have to publish it and it’s ready to be used

$ amc application publish <app name> 0

Now you can simply start a container for your new application by

$ amc launch <app name>

Access the Streaming UI

The Streaming Stack provides a simple, development focused UI to stream the visual output from an Android instance to a web browser. As access is secured, you have to create an account first:

$ juju run-action --wait anbox-stream-gateway/0 create-auth-token service=dev

The service property can have any value and is just a description of the account. Please note the
printed authentication token and store it somewhere securely as you will need it to access the
development UI. This token cannot be retrieved again later on.

From juju status you can get the IP address of the machine the Anbox Stream Gateway Load Balancer is running on.
With the IP address you can now access https://[anbox-stream-gatway-lb's address]/ui and you will be presented with the development UI.

Hint: The Stream Gateway uses self-signed certificates. You may see a warning from your browser and have to accept the certificates manually.

The authentication token now needs to be entered here to login into the UI. Once logged in you will see multiple options to start a streaming session. You can select a particular application, the resolution and frame rate, which region the session should run in etc.

Note that all of these options strictly follow the REST API the Anbox Stream Gateway provides as well.

Next Steps