Automate instance parameters¶
This feature is not available on Azure.
This chapter covers alternative methods to modify instances settings to ease deployment and post-deployment configuration.
To do so, we will be using the user data parameters , to set or modify the following parameters:
- Virtual Device display settings
- ADB connection (enable/disable)
- Authentication
- Domain name for SSL certificate
- Toggle root at boot*
*Not available for all Android versions. Check Root Access for more details.
More parameters will be added in the future.
Parameters and code¶
User parameters are in JSON format: { "parameter": "value" }
.
Supported objects and parameters are:
applyEveryBoot
-
Apply parameters values after every boot.
Type: Boolean
Default: false configuration
-
Set various parameters.
adb
-
ADB parameters.
active
-
Disable or enable ADB.
Type: Boolean
Default: false
authentication
-
Configure authentication.
enable
-
Enable or disable authentication.
Type: Boolean
Default: true username
-
User Name.
Type: String (SHA-1) password
-
Password.
Type: String (SHA-1)
root
-
Toggle root access.
active
-
Enable or disable root. Type: Boolean Default: false
hwProfile
-
Virtual Device hardware settings.
displaySettings
-
Display settings.
displays
-
Display settings for current display.
width
-
Display width (px).
Type: Integer
Default: 600 height
-
Display height (px).
Type: Integer
Default: 1024 density
-
Display density (ddp).
Type: Integer
Default: 180 contentPadding
-
Padding (dp) around status bar elements near the edge of the screen.
Type: Integer Default: 0 topCornerRadius
-
Radius (dp) of the rounded corners at the top of the display.
Type: Integer
Default: 0 bottomCornerRadius
-
Radius (dp) of the rounded corners at the bottom of the display.
Type: Integer
Default: 0
user_dns
-
Domain for SSL certificate.
Type: String
Username and Password¶
The username
and password
objects value must be encoded in SHA-1.
For example, if you wish to set "genymotion" username and "genYm01!" password:
-
Encode the strings into SHA-1:
-
Add in your JSON:
Example¶
{
"applyEveryBoot": true,
"configuration": {
"adb": {
"active": true
},
"authentication": {
"enable" : true,
"username": "0db0f30519f66ad6c9f4b42df56a7e08102e8374",
"password": "2eaa80a32c113dfe583f3d6120425fec54b89dd8"
},
"root": {
"active": true
}
},
"hwProfile": {
"displaySettings": {
"displays": [ {
"width": 768,
"height": 1280,
"density": 160,
"contentPadding": 125,
"topCornerRadius": 125,
"bottomCornerRadius": 0
}
]
}
},
"user_dns": "genymotion.com"
}
Usage by provider¶
Each Cloud provider has its own way to handle user data parameters. Please follow these tutorials to learn how to use them.
When creating an instance¶
The parameters can be set when creating the instance, in the Advanced details section at step 3 (Configure Instance):
You can then copy and paste your code, or import a file containing the code in JSON format.
The parameters can only be set from an existing instance when it is stopped. See On an existing instance below.
The parameters can be set when creating the instance, in the Management > Metadata section:
-
Click ADD ITEM
-
In the Key field, input the string
genymotionConfig
-
In the Value field, copy and paste your JSON code:
-
Create your instance.
Your parameters will be displayed in the VM instance details, in the Custom metadata section:
On an existing instance¶
Make sure the instance is stopped and go to Actions > Instance Settings > Edit user data:
You can then copy and paste your code, or import a file containing the code in JSON format.
- From the Aliyun console, go to Elastic Compute Service > Instances & Images > Instances
-
Click on a stopped instance to access its details:
-
Click on All Operations and select Set user data:
-
Copy and paste your JSON code:
-
Click Ok to apply the parameters.
Stop the instance if it is running and follow these steps:
- In VM instance details, click EDIT
-
In Custom metadata, click Add item
-
Set the Key to
genymotionConfig
and copy and paste your JSON code in the Value field:
-
Click Save