1# **Acloud Manual** 2 3## **Acloud** 4 5Acloud is a command line tool that assists users to create an Android Virtual 6Device (AVD). 7 8## **Table of Contents** 9 101. [Environment Setup](#Environment-Setup) 112. [Basic Usage](#Basic-Usage) 12 13### **Environment Setup** 14 15Add acloud to your $PATH by lunching your environment. 16 17* Source envsetup.sh from the root of the android source checkout 18 19``` 20$ source build/envsetup.sh 21``` 22 23* Run lunch for an AVD target 24 25``` 26$ lunch aosp_cf_x86_phone-userdebug 27``` 28 29 30You should now be able to call acloud from anywhere. 31 32### **Basic Usage** 33 34Acloud commands take the following form: 35 36**acloud <command> <optional arguments>** 37 38Available commands: 39 40* [create](#create) 41* [list](#list) 42* [delete](#delete) 43* [reconnect](#reconnect) 44* [setup](#setup) 45* [pull](#pull) 46 47#### **create** 48 49Create is the main entry point in creating an AVD, supporting both remote 50instance (running on a virtual machine in the cloud) and local instance 51(running on your local host) use cases. You also have the option to use 52a locally built image or an image from the Android Build servers. 53 54Here's a quick cheat-sheet for the 4 use cases: 55 56* Remote instance using an Android Build image (LKGB (Last Known Good Build) 57for cuttlefish phone target in the branch of your repo, default aosp main (master) 58if we can't determine it) 59 60> $ acloud create 61 62* Remote instance using a locally built image (use `m` to build the image) 63 64> $ acloud create --local-image [optional local-image-path] 65 66* Local instance using an Android Build image (LKGB for cuttlefish phone 67target in the branch of your repo) 68 69> $ acloud create --local-instance 70 71* Local instance using a locally built image (use `m` to build the image) 72 73> $ acloud create --local-instance --local-image 74 75When specifying an Android Build image, you can specify the branch, 76target and/or build id (e.g. `--branch my_branch`). Acloud will assume the 77following if they're not specified: 78 79* `--branch`: The branch of the repo you're running the acloud command in, e.g. 80in an aosp repo on the master branch, acloud will infer the aosp-main (aosp-master) branch. 81 82* `--build-target`: Defaults to the phone target for cuttlefish (e.g. 83aosp\_cf\_x86\_phone-userdebug in aosp-main (aosp-master)). 84 85* `--build-id`: Default to the Last Known Good Build (LKGB) id for the branch and 86target set from above. 87 88Additional helpful create options are: 89 90* `--config`: This can be one of phone, auto, tablet, tv. This wil be used to configure different types of hardware properties and infer build target if not specified. 91 92* `--autoconnect`: Cuttlefish AVD defaults to webrtc and acloud will automatically open the browser upon creation of a remote or local instance. 93Acloud will also create a ssh tunnel to enable adb and webrtc connection to the instance. Other AVD types(such as goldfish, cheeps...) still default to vnc. 94 95 * If you want to invoke vnc client, you can pass in `--autoconnect vnc`. 96 * If you don't want autoconnect, you can pass in `--no-autoconnect`. 97 98* `--hw-property`: This is a string where you can specify the different 99properties of the AVD. You can specify the cpu, resolution, dpi, memory,and/or 100disk in a key:value format like so: 101`cpu:2,resolution:1280x700,dpi:160,memory:2g,disk:2g` 102 103* `--reuse-gce`: 'cuttlefish only' This can help users use their own instance. 104Reusing specific gce instance if `--reuse-gce` [instance-name] is provided. 105Select one gce instance to reuse if `--reuse-gce` is provided. 106 107The full list of options are available via `--help` 108 109> $ acloud create --help 110 111#### **list** 112 113List will retrieve all the remote instances you've created in addition to 114any local instances created as well. 115 116Cheatsheet: 117 118* List will show device IP address, adb port and instance name. 119 120> $ acloud list 121 122* List -v will show more detail info on the list. 123 124> $ acloud list -v 125 126 127#### **delete** 128 129Delete will stop your remote and local instances. Acloud will find all 130instances created by you and stop them. If more than one instance is found 131(remote or local), you will be prompted to select which instance you would 132like to stop. 133 134Cheatsheet: 135 136* Delete sole instance or prompt user with list of instances to delete. 137 138> $ acloud delete 139 140* Delete all instances 141 142> $ acloud delete --all 143 144* Delete a specific instance 145 146> $ acloud delete --instance-names [instance-name] 147 148#### **reconnect** 149 150Reconnect will re-establish ssh tunnels for adb/webrtc/vnc port forwarding for all 151remote instance created by you. It will then look for any devices missing in 152`adb devices` and reconnect them to adb. Lastly it will restart webrtc/vnc for all 153devices that don't already have webrtc/vnc started for them. 154 155Cheatsheet: 156 157* Reconnect sole instance or prompt user with list of instances to reconnect. 158 159> $ acloud reconnect 160 161* Reconnect all instances 162 163> $ acloud reconnect --all 164 165* Reconnect a specific instance 166 167> $ acloud reconnect --instance-names [instance-name] 168 169 170### **pull** 171 172Pull will provide all log files to download or show in screen. It is helpful 173to debug about AVD boot up fail or AVD has abnromal behaviors. 174 175Cheatsheet: 176 177* Pull logs from a sole instance or prompt user to choose one to pull if where 178are more than one active instances. 179 180> $ acloud pull 181 182* Pull logs from the specific instance. 183 184> $ acloud pull --instance-name "instance-name" 185 186* Pull a specific log file from a specific instance 187 188> $ acloud pull --instance-name "instance-name" --file-name "file-name" 189 190 191#### **setup** 192 193Setup will walk you through the steps needed to set up your local host to 194create a remote or local instance. It will automatically get invoked through 195the create command if we detect some necessary setup steps are required. This 196is a standalone command if the user wants to do setup separate from the create 197command. 198 199Cheatsheet: 200 201* Run setup for remote/local instances 202 203> $ acloud setup 204 205* Run setup for remote instances only 206 207> $ acloud setup --gcp-init 208 209* Run setup for local instances only 210 211> $ acloud setup --host 212 213* Force run setup 214 215> $ acloud setup --force 216 217* * * 218 219If you have any questions or feedback, contact [acloud@google.com](mailto:acloud@google.com). 220 221If you have any bugs or feature requests email them to [buganizer-system+419709@google.com](mailto:buganizer-system+419709@google.com) 222