### Example: Start an Anbox instance Source: https://github.com/canonical/anbox-cloud-docs/blob/main/reference/cmd-ref/amc/ams.amc_start.md This example demonstrates the typical workflow of initializing an instance and then starting it. First, 'amc init' is used with an image or app ID, followed by 'amc start' using the returned instance ID. ```bash amc init ceg2ukbhc8ic3ftkc990 ``` ```bash amc start ceg2ukbhc8ic3ftkc990 ``` -------------------------------- ### Example: Initialize Instance with Application ID Source: https://github.com/canonical/anbox-cloud-docs/blob/main/reference/cmd-ref/amc/ams.amc_init.md This example shows how to initialize an instance using a specific application ID. After execution, you would typically use `amc start ` to launch the instance. ```bash $ amc init foo ``` -------------------------------- ### Install APT packages within instance Source: https://github.com/canonical/anbox-cloud-docs/blob/main/howto/images/publish-instance-as-image.md Example of installing additional software within an instance using its package manager. ```bash sudo apt install -y adb ``` -------------------------------- ### Build Minimal Platform Example Source: https://github.com/canonical/anbox-cloud-docs/blob/main/howto/anbox-runtime/develop-platform-plugin.md Commands to build the 'minimal' example platform plugin using CMake and Ninja. Ensure the Anbox Platform SDK is installed and the build environment matches the Anbox runtime's Ubuntu version. ```bash triplet=$(dpkg-architecture -qDEB_BUILD_MULTIARCH) cmake \ -G Ninja \ -B build \ -DCMAKE_PREFIX_PATH=../../lib/anbox-platform-sdk/ \ -DCMAKE_INSTALL_LIBDIR=lib/${triplet} \ -DCMAKE_INSTALL_PREFIX=/usr examples/minimal/ ninja -C build ``` -------------------------------- ### Example: Displaying a System Log Source: https://github.com/canonical/anbox-cloud-docs/blob/main/reference/cmd-ref/amc/ams.amc_show-log.md This example demonstrates how to retrieve the 'system.log' file for a specific instance identified by 'bknj0n9hpuo01q954fq0'. ```bash $ amc show-log bknj0n9hpuo01q954fq0 system.log ``` -------------------------------- ### Example: Publish Application Version '0' for Application 'foo' Source: https://github.com/canonical/anbox-cloud-docs/blob/main/reference/cmd-ref/amc/ams.amc_application_publish.md This example demonstrates how to publish version '0' of an application identified as 'foo'. ```bash $ amc application publish foo 0 ``` -------------------------------- ### Example: Set Node CPUs Source: https://github.com/canonical/anbox-cloud-docs/blob/main/reference/cmd-ref/amc/ams.amc_node_set.md This example demonstrates how to set the number of CPUs for a node named 'lxd0' to 8. ```bash $ amc node set lxd0 cpus 8 ``` -------------------------------- ### Setup Anbox Cloud GitHub Action Source: https://github.com/canonical/anbox-cloud-docs/blob/main/howto/install-appliance/install-on-github.md Use this action to install and configure Anbox Cloud on a GitHub runner. Replace 'main' with a specific git revision for better security. Ensure you have your Ubuntu Pro token configured as a repository secret. ```yaml name: Run integration tests on: push jobs: run-tests: runs-on: ubuntu-latest steps: - name: Setup Anbox Cloud # For best security replace "main" with the latest git revision of the # repository from https://github.com/canonical/anbox-cloud-github-action uses: canonical/anbox-cloud-github-action@main with: channel: latest/stable ubuntu-pro-token: ${{ secrets.UBUNTU_PRO_TOKEN }} ``` -------------------------------- ### Start a copied instance Source: https://github.com/canonical/anbox-cloud-docs/blob/main/howto/instance/copy-instance.md Start the newly created instance after the copy operation is complete. ```none amc start ``` -------------------------------- ### Example Directory Structure for Manifest and Extra Data Source: https://github.com/canonical/anbox-cloud-docs/blob/main/reference/application-manifest.md Illustrates the placement of the application package, extra data files, and the manifest YAML file. The 'extra-data' directory contains the files to be installed. ```bash . ├── app.apk ├── extra-data │ ├── com.canonical.candy.obb │ └── game-data-folder │ └── data.bin └── manifest.yaml ``` -------------------------------- ### Benchmark Output Example Source: https://github.com/canonical/anbox-cloud-docs/blob/main/howto/anbox/benchmarks.md Example output from the benchmark command, showing environment details, container launch progress, statistics, and boot times. ```bash 2019/01/21 11:11:49 Test environment: 2019/01/21 11:11:49 AMS version: 1.7 2019/01/21 11:11:49 Available nodes: 2019/01/21 11:11:49 lxd0 (CPU: 48, Memory: 185GB) 2019/01/21 11:11:49 2019/01/21 11:11:49 Launching 15 containers for application bh2q90vo3v1lt1ft4mlg with 0.1 containers per second 2019/01/21 11:11:49 2019/01/21 11:11:59 Launching container for application bh2q90vo3v1lt1ft4mlg ... 2019/01/21 11:12:05 Started container bh2qhvvo3v1lt1ft4ndg 2019/01/21 11:12:09 Launching container for application bh2q90vo3v1lt1ft4mlg ... 2019/01/21 11:12:15 Started container bh2qi2fo3v1lt1ft4neg 2019/01/21 11:12:19 Launching container for application bh2q90vo3v1lt1ft4mlg ... 2019/01/21 11:12:25 Started container bh2qi4vo3v1lt1ft4nfg 2019/01/21 11:12:29 Launching container for application bh2q90vo3v1lt1ft4mlg ... 2019/01/21 11:12:35 Started container bh2qi7fo3v1lt1ft4ngg 2019/01/21 11:12:39 Launching container for application bh2q90vo3v1lt1ft4mlg ... 2019/01/21 11:12:45 Started container bh2qi9vo3v1lt1ft4nhg 2019/01/21 11:12:49 Launching container for application bh2q90vo3v1lt1ft4mlg ... 2019/01/21 11:12:55 Started container bh2qicfo3v1lt1ft4nig 2019/01/21 11:12:59 Launching container for application bh2q90vo3v1lt1ft4mlg ... 2019/01/21 11:13:05 Started container bh2qievo3v1lt1ft4njg 2019/01/21 11:13:09 Launching container for application bh2q90vo3v1lt1ft4mlg ... 2019/01/21 11:13:15 Started container bh2qihfo3v1lt1ft4nkg 2019/01/21 11:13:19 Launching container for application bh2q90vo3v1lt1ft4mlg ... 2019/01/21 11:13:25 Started container bh2qijvo3v1lt1ft4nlg 2019/01/21 11:13:29 Launching container for application bh2q90vo3v1lt1ft4mlg ... 2019/01/21 11:13:35 Started container bh2qimfo3v1lt1ft4nmg 2019/01/21 11:13:39 Launching container for application bh2q90vo3v1lt1ft4mlg ... 2019/01/21 11:13:45 Started container bh2qiovo3v1lt1ft4nng 2019/01/21 11:13:49 Launching container for application bh2q90vo3v1lt1ft4mlg ... 2019/01/21 11:13:55 Started container bh2qirfo3v1lt1ft4nog 2019/01/21 11:13:59 Launching container for application bh2q90vo3v1lt1ft4mlg ... 2019/01/21 11:14:05 Started container bh2qitvo3v1lt1ft4npg 2019/01/21 11:14:09 Launching container for application bh2q90vo3v1lt1ft4mlg ... 2019/01/21 11:14:15 Started container bh2qj0fo3v1lt1ft4nqg 2019/01/21 11:14:19 Launching container for application bh2q90vo3v1lt1ft4mlg ... 2019/01/21 11:14:25 Started container bh2qj2vo3v1lt1ft4nrg 2019/01/21 11:14:25 Done starting all containers. Measuring container statistics for 1m0s ... 2019/01/21 11:15:25 Removing all containers ... 2019/01/21 11:15:25 Removing container bh2qi2fo3v1lt1ft4neg ... 2019/01/21 11:15:25 Removing container bh2qi7fo3v1lt1ft4ngg ... 2019/01/21 11:15:25 Removing container bh2qitvo3v1lt1ft4npg ... 2019/01/21 11:15:25 Removing container bh2qievo3v1lt1ft4njg ... 2019/01/21 11:15:25 Removing container bh2qj2vo3v1lt1ft4nrg ... 2019/01/21 11:15:25 Removing container bh2qj0fo3v1lt1ft4nqg ... 2019/01/21 11:15:25 Removing container bh2qicfo3v1lt1ft4nig ... 2019/01/21 11:15:25 Removing container bh2qihfo3v1lt1ft4nkg ... 2019/01/21 11:15:25 Removing container bh2qijvo3v1lt1ft4nlg ... 2019/01/21 11:15:25 Removing container bh2qimfo3v1lt1ft4nmg ... 2019/01/21 11:15:25 Removing container bh2qiovo3v1lt1ft4nng ... 2019/01/21 11:15:25 Removing container bh2qi4vo3v1lt1ft4nfg ... 2019/01/21 11:15:25 Removing container bh2qirfo3v1lt1ft4nog ... 2019/01/21 11:15:25 Removing container bh2qhvvo3v1lt1ft4ndg ... 2019/01/21 11:15:25 Removing container bh2qi9vo3v1lt1ft4nhg ... 2019/01/21 11:15:39 Containers boot time measurement: 2019/01/21 11:15:39 Launching all 15 containers took 2m36.560310342s 2019/01/21 11:15:39 Out of 15 containers 0 failed to launch 2019/01/21 11:15:39 Average container launch time: 6.149119411s 2019/01/21 11:15:39 Max container launch time: 6.576302043s 2019/01/21 11:15:39 Min container launch time: 5.911184959s 2019/01/21 11:15:39 Android system failed to boot in the following containers: 2019/01/21 11:15:39 None 2019/01/21 11:15:39 Containers statistics: 2019/01/21 11:15:39 FPS avg 58 min 52 max 64 for 15 containers 2019/01/21 11:15:39 Containers below run at low FPS(<30): 2019/01/21 11:15:39 None ``` -------------------------------- ### Install curl and python3 using a pre-start hook Source: https://github.com/canonical/anbox-cloud-docs/blob/main/howto/addons/install-tools-example.md Use this hook to install packages when the image is being created. It ensures tools are available for subsequent hooks or the application. ```bash #!/bin/bash -e # We only need to install things once when the image is being created, so we # don't need to execute the hook when users are running the application. if [ "$INSTANCE_TYPE" = "regular" ]; then exit 0 fi apt update -q apt install -y curl python3 ``` -------------------------------- ### Example: Add a node Source: https://github.com/canonical/anbox-cloud-docs/blob/main/reference/cmd-ref/amc/ams.amc_node_add.md This example demonstrates adding a node named 'lxd0' with the IP address '10.48.61.89' to AMS. ```bash $ amc node add lxd0 10.48.61.89 nodes: - lxd0 ``` -------------------------------- ### Example Directory Structure and Update Command Source: https://github.com/canonical/anbox-cloud-docs/blob/main/reference/cmd-ref/amc/ams.amc_application_update.md Shows a typical directory structure for an application and the command to update it. This example assumes the application ID is 'foo' and the application files are in 'foo-app/'. ```default tree foo-app foo-app/ ├── app.apk └── manifest.yaml amc application update foo foo-app/ ``` -------------------------------- ### Add Permissions Example Source: https://github.com/canonical/anbox-cloud-docs/blob/main/reference/cmd-ref/amc/ams.amc_auth_group_permission_add.md Example of assigning 'can_view' and 'can_edit' permissions to 'test-group-1' for the 'application' resource named 'foo'. ```bash $ amc auth group permission add test-group-1 application foo --permissions can_view,can_edit ``` -------------------------------- ### Start an Instance Without Waiting Source: https://github.com/canonical/anbox-cloud-docs/blob/main/howto/instance/start-instance.md Start an instance and exit immediately without waiting for it to be in a running state. This is useful for scripting or when immediate feedback is preferred. ```none amc start --no-wait ``` -------------------------------- ### Install Python venv and Dependencies Source: https://github.com/canonical/anbox-cloud-docs/blob/main/tutorial/stream-client.md Set up a Python virtual environment and install the necessary dependencies for the stream client using pip. ```none cd stream-client sudo apt install -y python3.12-venv ``` ```none python3 -m venv .venv . .venv/bin/activate pip3 install -r requirements.txt ``` -------------------------------- ### Example Application Status Output Source: https://github.com/canonical/anbox-cloud-docs/blob/main/howto/application/create-application.md This is an example of the output you might receive when checking an application's status. It includes the application ID, name, status, configuration details, and version information. ```bash id: bcmap7u5nof07arqa2ag name: candy status: initializing published: false config: instance-type: a4.3 boot-package: com.canonical.candy versions: 0: image: bf7u4cqkv5sg5jd5b2k0 (version 0) published: false status: initializing addons: - ssh boot-activity: com.canonical.candy.GameApp required-permissions: - android.permission.WRITE_EXTERNAL_STORAGE - android.permission.READ_EXTERNAL_STORAGE extra-data: com.canonical.candy.obb: target: /data/app/com.canonical.candy-1/lib game-data-folder: target: /sdcard/Android/data/com.canonical.candy/ watchdog: disabled: false allowed-packages: - com.android.settings services: - port: 5559 protocols: - tcp expose: false name: adb resources: cpus: 4 memory: 4GB disk-size: 8GB ``` -------------------------------- ### Start an Instance Source: https://github.com/canonical/anbox-cloud-docs/blob/main/howto/instance/start-instance.md Use this command to start a stopped or initialized Anbox Cloud instance. Replace with the actual ID of the instance. ```none amc start ``` -------------------------------- ### Start an Instance with Custom Timeout Source: https://github.com/canonical/anbox-cloud-docs/blob/main/howto/instance/start-instance.md Start an instance and specify a custom wait time for it to become running. The default timeout is 5 minutes. Use 'm' for minutes or 's' for seconds. ```none amc start --timeout 10m ``` -------------------------------- ### Anbox Cloud Benchmark Output Example Source: https://github.com/canonical/anbox-cloud-docs/blob/main/howto/anbox/benchmarks.md Example output from an Anbox Cloud benchmark run, detailing connection statistics, bandwidth, video performance, and frame metrics. ```bash I0104 13:03:09.860428 556511 benchmark.cpp:165] Created new session bvpg7vbmend4td6moir0 in region cloud-0 for application bombsquad-stress-nvc I0104 13:03:10.188585 556626 websocket_client.cpp:32] Successfully connected to websocket I0104 13:03:10.228832 556626 benchmark.cpp:273] Established connection with stream gateway at https://10.229.100.14 I0104 13:03:10.247896 556626 fake_video_decoder_factory.cpp:149] Adding decoding support for H264 I0104 13:03:10.247918 556626 fake_video_decoder_factory.cpp:161] Adding decoding support for VP8 I0104 13:03:10.309556 556626 peer_connection.cpp:233] Using the following STUN/TURN servers: I0104 13:03:10.309569 556626 peer_connection.cpp:236] stun:stun.l.google.com:19302 I0104 13:03:10.309572 556626 peer_connection.cpp:236] turn:10.229.100.15:5349 I0104 13:03:10.362562 556626 benchmark.cpp:319] Creating offer to establish connection with the other peer I0104 13:03:10.378496 556637 peer_connection.cpp:866] Adjusted bitrate for all video and audio encodings on our RTP senders I0104 13:03:10.378552 556637 benchmark.cpp:370] Offer was created, sharing with the other side I0104 13:03:38.232844 556637 peer_connection.cpp:746] New stream stream_id added I0104 13:03:38.820360 556637 benchmark.cpp:396] Connection with other peer is established (took 29s) I0104 13:03:38.820413 556637 benchmark.cpp:181] Using 10s as sample interval I0104 13:03:38.820453 556511 main.cpp:165] Connected, starting execution timeout of 1min I0104 13:03:38.925285 556626 websocket_client.cpp:67] Websocket connection was closed I0104 13:03:39.048584 556637 peer_connection.cpp:759] New data channel control added E0104 13:03:40.437090 557770 fake_video_decoder_factory.cpp:63] Failed to create video dumper I0104 13:03:40.437153 557770 fake_video_decoder_factory.cpp:65] Initialized video decoder for codec H264 I0104 13:04:39.508816 556511 main.cpp:200] Finished benchmark, generating report ... +-----------------------------------------------------------------------------------------------------------------------------------------------------+ | Connection | Average | Min | Max | Stddev | Count | +-----------------------------------------------------------------------------------------------------------------------------------------------------+ | Round trip time (ms) | 103.40 | 101.00 | 107.00 | 2.94 | 5.00 | | Bandwidth (Mbit/s) | 0.00 | 0.00 | 0.00 | 0.00 | 5.00 | +-----------------------------------------------------------------------------------------------------------------------------------------------------+ | Video | Average | Min | Max | Stddev | Count | +-----------------------------------------------------------------------------------------------------------------------------------------------------+ | Bandwidth (Mbit/s) | 10.55 | 9.08 | 11.88 | 0.95 | 5.00 | | Frames per second | 66.00 | 62.00 | 69.00 | 3.29 | 5.00 | | Frames received | 621.20 | 619.00 | 623.00 | 1.47 | 5.00 | | Frames decoded | 621.40 | 617.00 | 623.00 | 2.24 | 5.00 | | Frames dropped | 0.00 | 0.00 | 0.00 | 0.00 | 5.00 | | Freeze count | 0.00 | 0.00 | 0.00 | 0.00 | 5.00 | | Pause count | 0.00 | 0.00 | 0.00 | 0.00 | 5.00 | | Key frames decoded | 4.80 | 4.00 | 5.00 | 0.40 | 5.00 | +-----------------------------------------------------------------------------------------------------------------------------------------------------+ ``` -------------------------------- ### Example application show output Source: https://github.com/canonical/anbox-cloud-docs/blob/main/howto/application/update-application.md This is an example of the detailed output from the `amc application show` command, illustrating the structure of application information, including its versions, status, and configuration. ```bash id: bcmap7u5nof07arqa2ag name: candy status: ready published: false config: instance-type: a4.3 boot-package: com.canonical.candy versions: 0: image: bf7u4cqkv5sg5jd5b2k0 (version 0) published: false status: active addons: - ssh boot-activity: com.canonical.candy.GameApp required-permissions: - android.permission.WRITE_EXTERNAL_STORAGE - android.permission.READ_EXTERNAL_STORAGE extra-data: com.canonical.candy.obb: target: /data/app/com.canonical.candy-1/lib game-data-folder: target: /sdcard/Android/data/com.canonical.candy/ watchdog: disabled: false allowed-packages: - com.android.settings services: - port: 5559 protocols: - tcp expose: false name: adb 1: image: bf7u4cqkv5sg5jd5b2k0 (version 0) published: false status: active addons: - ssh boot-activity: com.canonical.candy.GameApp required-permissions: - android.permission.READ_EXTERNAL_STORAGE - android.permission.READ_EXTERNAL_STORAGE extra-data: com.canonical.candy.obb: target: /data/app/com.canonical.candy-1/lib watchdog: disabled: false allowed-packages: - com.android.settings services: - port: 5559 protocols: - tcp expose: false name: adb resources: cpus: 4 memory: 4GB disk-size: 8GB ``` -------------------------------- ### Initialize Anbox Cloud Appliance Installation Source: https://github.com/canonical/anbox-cloud-docs/blob/main/howto/install-appliance/install-on-aws.md Initializes the Anbox Cloud appliance installation. This command may prompt for configuration details; default answers can be accepted if no specific changes are needed. ```bash sudo anbox-cloud-appliance init ``` -------------------------------- ### Add a base image Source: https://github.com/canonical/anbox-cloud-docs/blob/main/reference/cmd-ref/amc/ams.amc_image_add.md Example of adding a base image with a specified name and path. ```bash $ amc image add base path/to/image ``` -------------------------------- ### Example: Display Identity Details Source: https://github.com/canonical/anbox-cloud-docs/blob/main/reference/cmd-ref/amc/ams.amc_auth_identity_show.md This example demonstrates how to retrieve and display the details of a specific identity, identified by 'bknj0n9hpuo01q954fq0'. The output includes fields like ID, authentication method, groups, email, and timestamps. ```default $ amc auth identity show bknj0n9hpuo01q954fq0 id: bknj0n9hpuo01q954fq0 authentication-method: oidc groups: [] email: test-user@anbox-cloud.io created-at: 1970-01-01 00:00:00 +0000 UTC updated-at: 1970-01-01 00:00:00 +0000 UTC name: test-user ``` -------------------------------- ### Example: Show Application Details Source: https://github.com/canonical/anbox-cloud-docs/blob/main/reference/cmd-ref/amc/ams.amc_application_show.md Demonstrates how to display detailed information for an application named 'foo'. The output includes ID, name, status, and configuration details. ```bash $ amc application show foo id: bkmtdm9hpuo01q954fng name: foo status: ready published: true immutable: false vm: false inhibit-auto-updates: false parent-image: jammy:android13:amd64 parent-image-variant: android tags: [] config: instance-type: a2.3 boot-package: com.android.foo versions: 0: image: bkkbiaphpuo3mh78ain0 (version 0) manifest-version: 0.1 published: true status: active extra-data: {} ``` -------------------------------- ### Install Missing Library in Pre-start Hook Source: https://github.com/canonical/anbox-cloud-docs/blob/main/reference/release-notes/1.20.1.md Use this script in a pre-start hook to install the missing libgl1-mesa-dri library for Android 11 instances experiencing startup issues with pure software rendering. ```shell #!/bin/sh -ex if [ "$CONTAINER_TYPE" = "regular" ]; then exit 0 fi apt update apt install --no-install-recommends -y libgl1-mesa-dri ``` -------------------------------- ### Initialize Appliance with Preseed Source: https://github.com/canonical/anbox-cloud-docs/blob/main/howto/setup-custom-idp/configure-oidc.md Start the appliance initialization process using the configured preseed.yaml file. ```bash sudo anbox-cloud-appliance init --preseed < preseed.yaml ``` -------------------------------- ### Launch an instance Source: https://github.com/canonical/anbox-cloud-docs/blob/main/howto/images/publish-instance-as-image.md Use this command to create a new instance from an existing image. Ensure the instance is up and running before proceeding. ```bash amc launch --name=test0 jammy:android15:amd64 ``` -------------------------------- ### Prepare Node for Anbox Cloud Installation Source: https://github.com/canonical/anbox-cloud-docs/blob/main/howto/install-appliance/install-on-aws.md Installs necessary kernel modules and GPU driver packages for Anbox Cloud. This script prepares the machine for further Anbox Cloud setup. ```bash anbox-cloud-appliance prepare-node-script | sudo bash -ex ``` -------------------------------- ### Copy and launch an instance Source: https://github.com/canonical/anbox-cloud-docs/blob/main/howto/instance/copy-instance.md Copy an instance and start it immediately after the copy process completes using the `--launch` flag. ```none amc copy --launch ``` -------------------------------- ### Load fish completions for every new session Source: https://github.com/canonical/anbox-cloud-docs/blob/main/reference/cmd-ref/appliance/anbox-cloud-appliance_completion_fish.md To load completions for every new session, redirect the output to a fish completion file. You will need to start a new shell for this setup to take effect. ```none anbox-cloud-appliance completion fish > ~/.config/fish/completions/anbox-cloud-appliance.fish ``` -------------------------------- ### Launch instance with service access, addons, and raw mode Source: https://github.com/canonical/anbox-cloud-docs/blob/main/reference/cmd-ref/amc/ams.amc_launch.md Launches an instance with specified TCP and UDP service ports, enables addons, and uses raw mode. ```bash $ amc launch foo --service tcp:8080 --service tcp,udp:9000-9100 --addons bar --raw ``` -------------------------------- ### Change Android System Locale Hook Source: https://github.com/canonical/anbox-cloud-docs/blob/main/howto/application/extend-application.md This script installs and configures an application to change the Android system locale to Korean. It handles different instance types and ensures the locale initialization by starting and broadcasting to the CustomLocale2 app. Replace `` with the appropriate environment variable ($APP_DIR or $ADDON_DIR). ```shell #!/bin/sh -ex if [ "$INSTANCE_TYPE" = "regular" ]; then exit 0 fi cp ""/*.apk $ANBOX_DIR/data anbox-shell pm install -t -g /data/CustomLocale.apk && sleep 5 # Start CustomLocale2 application after installation, this aims to # initialize all available locales in the app, otherwise the following # system language broadcast won't work anbox-shell am start -n com.android.customlocale2/.CustomLocaleActivity && sleep 5 # Change the system language by sending the broadcast to CustomLocale2 anbox-shell am broadcast \ -a com.android.intent.action.SET_LOCALE \ --es com.android.intent.extra.LOCALE "ko_KR" \ com.android.customlocale2 sleep 5 ``` -------------------------------- ### amc init Source: https://github.com/canonical/anbox-cloud-docs/blob/main/reference/cmd-ref/amc/ams.amc_init.md Creates an Anbox instance without starting it. You can later start the instance using 'amc start '. ```APIDOC ## ams.amc init ### Description Create an instance but do not start it immediately. To start such an instance, run ‘amc start ’. ### Synopsis ```default ams.amc init ( | ) [flags] ``` ### Parameters #### Path Parameters - **app_id** (string) - The ID of the application to create an instance from. - **image_id** (string) - The ID of the image to create an instance from. #### Flags - **-a, --addons** (string) - Comma-separated list of addons to install in the instance (raw instances only). - **--application-version** (int) - Specific version of an application to use when creating an instance. - **--config** (stringArray) - Instance configuration, e.g., security.delete_protected=true (can be used multiple times). - **-c, --cpus** (int) - Number of CPU cores to be assigned for the instance (for example, 2). If not specified, the number of CPU cores specified by the instance type will be used. (default 2). - **--devmode** - Enable developer mode for the instance (default disabled). - **--disable-watchdog** - Disable watchdog for the instance (regular instances only). - **-d, --disk-size** (string) - Disk size of the instance (for example, 5GB). If not specified, the disk size specified by the instance type will be used. - **--display-density** (int) - Pixel density of the virtual display of the instance (default 240). - **--display-size** (string) - Size of the virtual display of the instance in the format x (default "1280x720"). - **--enable-graphics** - Enable graphics for the instance (default: disabled). - **--enable-streaming** - Enable streaming for the instance (default: disabled). - **-f, --features** (string) - Comma-separated list of features to enable for the Anbox runtime inside the instance. - **--fps** (int) - Frame rate the virtual display of the instance (default 60). - **-g, --gpu-slots** (int) - Number of GPU slots to be assigned for the instance (for example, 1). If not specified, the number of GPU slots specified by the instance type will be used. (default -1). - **--gpu-type** (string) - Type of the GPU to select for the instance. If not given the GPU with the minimum usage is assigned to the instance on the node it is scheduled on. Possible values are: amd, intel, nvidia. - **-h, --help** - help for init. - **-i, --instance-type** (string) - Instance type to use for the instance when creating a raw instance. - **-m, --memory** (string) - Memory to be assigned for the instance (for example, 3GB). If not specified, the memory specified by the instance type will be used. - **--metrics-server** (string) - Metrics server to which the instance sends its data. - **--name** (string) - Name of the instance. Must be unique, 3–63 characters, alphanumeric or hyphens, cannot start or end with a hyphen. - **--no-disk-reserve** - Create the instance with a non-reserved disk space (default: disabled). - **--no-wait** - Don't wait for the instance to start before returning (default: disabled). - **-n, --node** (string) - LXD node to use for creating the instance. - **-p, --platform** (string) - Anbox platform to use. - **-r, --raw** - If specified, create a raw instance for the specified image instead of an application instance. - **-s, --service** (stringArray) - Services to expose on the instance IP endpoint for external access (public or private). - **--tags** (string) - Comma-separated list of tags to set for the instance. - **-t, --timeout** (string) - Maximum time to wait for the operation to complete (default "5m"). - **--userdata** (string) - String with additional user data to be pushed into the created instance. - **--userdata-path** (string) - Path to a file with additional user data to be pushed into the created instance. - **--version** (int) - Specific version of an application or image to use when creating an instance (default -1). - **--vm** - Create a virtual machine instead of a container (default: disabled). - **-v, --vpu-slots** (int) - Number of VPU slots to be assigned for the instance (for example, 1). If not specified, the number of VPU slots specified by the instance type will be used. (default -1). ### Examples ```default $ amc init foo ``` ``` -------------------------------- ### Example Anbox Cloud Appliance Initialization with Preseed Source: https://github.com/canonical/anbox-cloud-docs/blob/main/reference/appliance-preseed.md This snippet demonstrates how to initialize the Anbox Cloud Appliance non-interactively using a preseed configuration provided via standard input. ```none cat << EO | sudo anbox-cloud-appliance init --preseed network: listen-address: 192.168.11.4 lxd: storage-pool: my-pool project: anbox-cloud ams: api: allowed-uid: [0, 1000] EOF ``` -------------------------------- ### Install Juju using Snap Source: https://github.com/canonical/anbox-cloud-docs/blob/main/reference/requirements.md Installs Juju version 3.x using snap. Replace '3' with a different version number to install an alternative. ```none snap install --channel=3/stable juju ``` -------------------------------- ### Addon Structure Example Source: https://github.com/canonical/anbox-cloud-docs/blob/main/howto/addons/create-addon.md Illustrates the expected file and directory structure for an addon, including the manifest, hooks directory, and key files. ```text ssh-addon ├── hooks │ └── pre-start ├── manifest.yaml └── ssh-addon-key.pub ``` -------------------------------- ### amc start command synopsis Source: https://github.com/canonical/anbox-cloud-docs/blob/main/reference/cmd-ref/amc/ams.amc_start.md This is the general syntax for the amc start command. Replace with the ID of the instance you wish to start. Flags can be used to modify the command's behavior. ```bash ams.amc start [flags] ``` -------------------------------- ### Help Option Source: https://github.com/canonical/anbox-cloud-docs/blob/main/reference/cmd-ref/amc/ams.amc_connect.md Use the -h or --help flag to display help information for the connect command. ```default -h, --help help for connect ``` -------------------------------- ### Install Multipass Source: https://github.com/canonical/anbox-cloud-docs/blob/main/tutorial/installing-appliance.md Install the Multipass package manager to manage virtual machines. ```none snap install multipass ``` -------------------------------- ### Launch Instance with Custom Streaming Settings Source: https://github.com/canonical/anbox-cloud-docs/blob/main/howto/instance/create-instance.md Launches an instance with streaming enabled and customizes streaming parameters like display size, density, and frame rate. ```bash amc launch --enable-streaming --display-size=1920x1080 --display-density=120 --fps=60 ... ``` -------------------------------- ### amc start command options Source: https://github.com/canonical/anbox-cloud-docs/blob/main/reference/cmd-ref/amc/ams.amc_start.md These options modify the behavior of the 'amc start' command. Use '--no-wait' to return immediately without waiting for the instance to fully start, or '--timeout' to specify a maximum waiting period. The '-y' or '--yes' flag can be used to force starting an instance from an error state. ```bash -h, --help help for start ``` ```bash --no-wait Don't wait for the instance to start before returning (default disabled) ``` ```bash -t, --timeout string Maximum time to wait for the operation to complete (default "5m") ``` ```bash -y, --yes error Force start the instance from error state ``` -------------------------------- ### Configure Display Specification for Null Platform Benchmark Source: https://github.com/canonical/anbox-cloud-docs/blob/main/howto/anbox/benchmarks.md Provide display settings as comma-separated values for the `--userdata` parameter when benchmarking the `null` platform. This example sets width to 1280, height to 720, FPS to 60, and density to 160. ```bash amc benchmark --userdata "1280,720,60,160" ``` -------------------------------- ### Code Block Example Source: https://github.com/canonical/anbox-cloud-docs/blob/main/contribute/doc-cheat-sheet.md Demonstrates a basic code block. Use this for general code examples. ```yaml code: - example: true ``` -------------------------------- ### Example of Unsetting Application Tags Source: https://github.com/canonical/anbox-cloud-docs/blob/main/reference/cmd-ref/amc/ams.amc_application_unset.md This example demonstrates how to unset the 'tags' field for an application with the ID 'foo'. ```default $ amc application unset foo tags ``` -------------------------------- ### List All Applications Source: https://github.com/canonical/anbox-cloud-docs/blob/main/howto/application/list-applications.md Run this command to display all applications available in the system. ```none amc application ls ``` -------------------------------- ### Install socat Source: https://github.com/canonical/anbox-cloud-docs/blob/main/howto/stream/exchange-oob-data.md Installs the socat utility, which is used to establish connections to Unix domain sockets for data exchange. ```bash sudo apt install socat ``` -------------------------------- ### Show Help Option Source: https://github.com/canonical/anbox-cloud-docs/blob/main/reference/cmd-ref/appliance/anbox-cloud-appliance_config_show.md This option displays help information for the 'show' command within the appliance configuration context. ```bash -h, --help help for show ``` -------------------------------- ### Launch an instance in development mode Source: https://github.com/canonical/anbox-cloud-docs/blob/main/howto/anbox-runtime/develop-addon-devmode.md Use this command to start a raw instance with `--devmode` enabled. Note the instance ID for subsequent steps. ```bash amc launch --devmode ``` ```bash amc launch --vm --devmode ``` -------------------------------- ### Install AMC Snap Source: https://github.com/canonical/anbox-cloud-docs/blob/main/howto/anbox/control-ams-remotely.md Install the Anbox Management Client (AMC) snap. This is a prerequisite for controlling AMS remotely. ```none snap install amc ``` -------------------------------- ### Install SSL Certificate on Appliance Source: https://github.com/canonical/anbox-cloud-docs/blob/main/howto/anbox/tls-for-appliance.md Copy the generated certificate and private key to the appliance's daemon directory and restart the service to apply changes. ```bash sudo cp /etc/letsencrypt/live//fullchain.pem /var/snap/anbox-cloud-appliance/common/daemon/server.crt sudo cp /etc/letsencrypt/live//privkey.pem /var/snap/anbox-cloud-appliance/common/daemon/server.key sudo snap restart anbox-cloud-appliance.daemon ``` -------------------------------- ### GET /1.0/camera Source: https://github.com/canonical/anbox-cloud-docs/blob/main/reference/api-reference/anbox-https-api.md Get camera basic information, including data availability, enabled status, and supported resolutions. ```APIDOC ## GET /1.0/camera ### Description Get camera basic information, including data availability, enabled status, and supported resolutions. ### Method GET ### Endpoint /1.0/camera ### Response #### Success Response (200) - **metadata** (object) - Contains camera metadata. - **data_available** (boolean) - The availability of camera data. - **enabled** (boolean) - Is the camera support enabled in Anbox. - **resolutions** (array) - The supported camera resolutions. - **height** (integer) - The height of the resolution dimension. - **width** (integer) - The width of the resolution dimension. - **status** (string) - Status of the operation. - **status_code** (integer) - HTTP status code. - **type** (string) - Type of operation. #### Response Example { "metadata": { "data_available": false, "enabled": false, "resolutions": [ { "height": 720, "width": 1280 } ] }, "status": "Success", "status_code": 200, "type": "sync" } ``` -------------------------------- ### Create an application from a directory Source: https://github.com/canonical/anbox-cloud-docs/blob/main/reference/cmd-ref/amc/ams.amc_application_create.md Use this command to create a new application by packaging its contents from a local directory. Ensure the directory contains an APK and a manifest file. ```bash ams.amc application create my-app ``` -------------------------------- ### Install anbox-connect Source: https://github.com/canonical/anbox-cloud-docs/blob/main/howto/android/access-android-instance.md Installs the anbox-connect tool on the host machine. This tool is required for establishing ADB connections to Anbox instances. ```bash snap install anbox-connect ``` -------------------------------- ### Launch instance from published image Source: https://github.com/canonical/anbox-cloud-docs/blob/main/howto/images/publish-instance-as-image.md Create a new instance using the image that was just published to verify its contents. ```bash amc launch --name test1 test ``` -------------------------------- ### Example of System Log Output Source: https://github.com/canonical/anbox-cloud-docs/blob/main/howto/instance/view-instance-logs.md This is an example of the output you might see when viewing a system log file for a failed instance. ```log -- Logs begin at Thu 2019-01-17 08:37:56 UTC, end at Thu 2019-01-17 08:38:58 UTC. -- Jan 17 08:37:56 ams-bh03th0j1qm6416q0v30 systemd-journald[38]: Journal started Jan 17 08:37:56 ams-bh03th0j1qm6416q0v30 systemd-journald[38]: Runtime journal (/run/log/journal/2c8dee797148423b8f8987009ee28eab) is 8.0M, max 99.6M, 91.6M free. Jan 17 08:37:56 ams-bh03th0j1qm6416q0v30 systemd[1]: Starting Flush Journal to Persistent Storage... .... Jan 17 08:38:57 ams-bh03th0j1qm6416q0v30 acc[607]: 2019/01/17 08:38:57 Extracting application package ... Jan 17 08:38:58 ams-bh03th0j1qm6416q0v30 acc[607]: 2019/01/17 08:38:58 Waiting for Android container Jan 17 08:38:58 ams-bh03th0j1qm6416q0v30 acc[607]: 2019/01/17 08:38:58 Installing application com.canonical.candy from app.apk ... ``` -------------------------------- ### Launch an Instance Source: https://github.com/canonical/anbox-cloud-docs/blob/main/tutorial/create-test-virtual-device.md Launches and streams a new instance for a specified application. Use the application name or ID. The `--enable-streaming` flag is optional. ```none amc launch my-first-app --enable-streaming ``` -------------------------------- ### Launch an Android Instance Source: https://github.com/canonical/anbox-cloud-docs/blob/main/howto/android/simulate-incoming-sms.md Launches a new Android instance. Ensure the instance is running before proceeding. ```none amc launch --name test0 jammy:android15:amd64 ``` -------------------------------- ### Install Anbox Platform SDK Build Dependencies Source: https://github.com/canonical/anbox-cloud-docs/blob/main/reference/sdks.md Install the necessary build dependencies for the Anbox Platform SDK using apt. ```bash sudo apt install -y --no-install-recommends cmake build-essential ninja-build dh-exec cmake-extras libgmock-dev libelf-dev ``` -------------------------------- ### Launch instance with custom user data for display settings Source: https://github.com/canonical/anbox-cloud-docs/blob/main/reference/cmd-ref/amc/ams.amc_launch.md Launches an instance and passes custom user data, including display width, height, and FPS, using the --userdata flag. ```bash $ amc launch foo --enable-graphics --userdata '{"display_width":1920, "display_height":1080, "fps": 60}' ``` -------------------------------- ### Addon Structure Example Source: https://github.com/canonical/anbox-cloud-docs/blob/main/reference/cmd-ref/amc/ams.amc_addon_add.md Demonstrates the expected directory structure for a custom addon, which must include a manifest and hooks. ```shell tree my-addon my-addon/ ├── hooks │   └── install └── manifest.yaml ``` -------------------------------- ### Install Terraform Source: https://github.com/canonical/anbox-cloud-docs/blob/main/howto/install/deploy-terraform.md Installs the Terraform CLI using snap. This command ensures you have the latest stable version of Terraform available on your system. ```bash sudo snap install --classic --channel=latest/stable terraform ``` -------------------------------- ### Create and Configure Android Instance Source: https://github.com/canonical/anbox-cloud-docs/blob/main/howto/install-appliance/install-on-github.md Launches an Android instance with specified version and architecture, ensuring it's configured for ADB access. The instance ID is output for subsequent steps. Set USE_VM to true to launch Android in a VM instead of a system container. ```bash arch=amd64 if [ "$(uname -m)" = aarch64 ]; then arch=arm64 fi args=() if [ "$USE_VM" = true ]; then args+=(--vm) fi image=jammy:android"$ANDROID_VERSION":"$arch" id="$(amc launch -r -s adb "${args[@]}" --name android0 "$image")" amc wait -c status=running "$id" echo "id=$id" >> "$GITHUB_OUTPUT" ``` -------------------------------- ### Install Anbox Cloud Validation Tests Source: https://github.com/canonical/anbox-cloud-docs/blob/main/howto/install/validate-deployment.md Install the Anbox Cloud validation tests snap package from the Canonical snap store. ```none snap install anbox-cloud-tests ``` -------------------------------- ### Install curl and jq Source: https://github.com/canonical/anbox-cloud-docs/blob/main/howto/android/set-automotive-properties.md Install the curl and jq command-line tools within the instance terminal to interact with the Anbox HTTP API. ```bash sudo apt update sudo apt install curl ``` ```bash sudo apt install jq ``` -------------------------------- ### Launch instance with specific application version Source: https://github.com/canonical/anbox-cloud-docs/blob/main/reference/cmd-ref/amc/ams.amc_launch.md Launches an instance and specifies the application version to use with the --version flag. ```bash $ amc launch foo --version 2 ``` -------------------------------- ### Install AAR Snap Source: https://github.com/canonical/anbox-cloud-docs/blob/main/howto/aar/configure.md Install the AAR snap package on the machine hosting the AAR. Replace with the desired snap version. ```bash sudo snap install --channel= aar ``` -------------------------------- ### Launch an Anbox Cloud Instance with Streaming Source: https://github.com/canonical/anbox-cloud-docs/blob/main/howto/android/access-android-instance.md Launches a new Anbox Cloud instance named 'demo' and enables streaming. This is a prerequisite for both anbox-shell and anbox-connect. ```bash amc launch --name=demo --enable-streaming ``` -------------------------------- ### amc info Command Example Output Source: https://github.com/canonical/anbox-cloud-docs/blob/main/reference/cmd-ref/amc/ams.amc_info.md Example output of the 'amc info' command, showing service details in YAML format. ```default api_extensions: - addon_backup_hook ... - application_hooks api_status: stable api_version: "1.0" auth: trusted auth_methods: - 2waySSL config: application.addons: "" ... scheduler.strategy: spread service_version: 1.14.0 ``` -------------------------------- ### Anbox IVehicle Interface Implementation Example Source: https://github.com/canonical/anbox-cloud-docs/blob/main/howto/android/integrate-hidl.md Example implementation of the IVehicle interface, including access control checks for vehicle properties. ```cpp Return VHalService::get( const VehiclePropValue& requestedPropValue, IVehicle::get_cb _hidl_cb) { uid_t uid = android::IPCThreadState::self()->getCallingUid(); if (uid != AID_VEHICLE_NETWORK) { _hidl_cb(StatusCode::ACCESS_DENIED, kEmptyValue); return Void(); } // NOTE: a VHAL implementation must allow access to non-readable vehicle properties. return Void(); } Return VHalService::set(const VehiclePropValue& value) { uid_t uid = android::IPCThreadState::self()->getCallingUid(); if (uid != AID_VEHICLE_NETWORK) return StatusCode::ACCESS_DENIED; // NOTE: a VHAL implementation must allow modification of non-writable vehicle properties. return StatusCode::NOT_AVAILABLE; } ``` -------------------------------- ### Install Certbot Snap Source: https://github.com/canonical/anbox-cloud-docs/blob/main/howto/anbox/tls-for-appliance.md Install the Certbot snap to manage SSL certificates. Ensure TCP port 80 is free before running Certbot. ```bash sudo snap install --classic certbot ```