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* `--flavor`: This can be one of phone, auto, wear, tv, iot, tablet and 3g. 91This will be used to choose the default hw properties and infer build target 92if not specified. 93 94* `--autoconnect`: This defaults to true and upon creation of a remote instance, 95creates a ssh tunnel to enable adb and vnc connection to the instance. For the 96local instance, acloud will just invoke the vnc client. If you don't want 97autoconnect, you can pass in `--no-autoconnect` 98 99* `--unlock`: This can unlock screen after invoke the vnc client. 100 101* `--hw-property`: This is a string where you can specify the different 102properties of the AVD. You can specify the cpu, resolution, dpi, memory,and/or 103disk in a key:value format like so: 104`cpu:2,resolution:1280x700,dpi:160,memory:2g,disk:2g` 105 106* `--reuse-gce`: 'cuttlefish only' This can help users use their own instance. 107Reusing specific gce instance if `--reuse-gce` [instance-name] is provided. 108Select one gce instance to reuse if `--reuse-gce` is provided. 109 110The full list of options are available via `--help` 111 112> $ acloud create --help 113 114#### **list** 115 116List will retrieve all the remote instances you've created in addition to 117any local instances created as well. 118 119Cheatsheet: 120 121* List will show device IP address, adb port and instance name. 122 123> $ acloud list 124 125* List -v will show more detail info on the list. 126 127> $ acloud list -v 128 129 130#### **delete** 131 132Delete will stop your remote and local instances. Acloud will find all 133instances created by you and stop them. If more than one instance is found 134(remote or local), you will be prompted to select which instance you would 135like to stop. 136 137Cheatsheet: 138 139* Delete sole instance or prompt user with list of instances to delete. 140 141> $ acloud delete 142 143* Delete all instances 144 145> $ acloud delete --all 146 147* Delete a specific instance 148 149> $ acloud delete --instance-names [instance-name] 150 151#### **reconnect** 152 153Reconnect will re-establish ssh tunnels for adb/vnc port forwarding for all 154remote instance created by you. It will then look for any devices missing in 155`adb devices` and reconnect them to adb. Lastly it will restart vnc for all 156devices that don't already have vnc started for them. 157 158Cheatsheet: 159 160* Reconnect sole instance or prompt user with list of instances to reconnect. 161 162> $ acloud reconnect 163 164* Reconnect all instances 165 166> $ acloud reconnect --all 167 168* Reconnect a specific instance 169 170> $ acloud reconnect --instance-names [instance-name] 171 172 173### **pull** 174 175Pull will provide all log files to download or show in screen. It is helpful 176to debug about AVD boot up fail or AVD has abnromal behaviors. 177 178Cheatsheet: 179 180* Pull logs from a sole instance or prompt user to choose one to pull if where 181are more than one active instances. 182 183> $ acloud pull 184 185* Pull logs from the specific instance. 186 187> $ acloud pull --instance-name "instance-name" 188 189* Pull a specific log file from a specific instance 190 191> $ acloud pull --instance-name "instance-name" --file-name "file-name" 192 193 194#### **setup** 195 196Setup will walk you through the steps needed to set up your local host to 197create a remote or local instance. It will automatically get invoked through 198the create command if we detect some necessary setup steps are required. This 199is a standalone command if the user wants to do setup separate from the create 200command. 201 202Cheatsheet: 203 204* Run setup for remote/local instances 205 206> $ acloud setup 207 208* Run setup for remote instances only 209 210> $ acloud setup --gcp-init 211 212* Run setup for local instances only 213 214> $ acloud setup --host 215 216* Force run setup 217 218> $ acloud setup --force 219 220* * * 221 222If you have any questions or feedback, contact [acloud@google.com](mailto:acloud@google.com). 223 224If you have any bugs or feature requests email them to [buganizer-system+419709@google.com](mailto:buganizer-system+419709@google.com)