Changing the OS Image of a Lite Server
Example Code
In ModelArts Notebook, you do not need to enter authentication parameters for session authentication. For details about session authentication of other development environments, see Session Authentication.
from modelarts.server_mgmt import ServerManagement
from modelarts.session import Session
from modelarts.servers.server_def import ImageBody
change_body = ImageBody(key_pair_name="KeyPair-3d6a",
image_id="e16eff65-1899-446e-baf2-0d2b6b5dd8c0")
ServerManagement.change_server_image(session = Session(), server_id = "server_id",change_body = change_body) #Enter hps_cluster_id.
Parameters
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
server_id |
Yes |
String |
Lite Server ID. |
|
session |
Yes |
Class |
Manage the interaction with Lite Server and provide project ID (project_id). |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
admin_pass |
No |
String |
Password for logging in to the server. Note that either admin_pass or key_pair_name must be specified. The new password must comply with the following rules:
|
|
key_pair_name |
No |
String |
Name of the key pair for logging in to the server. Either admin_pass or key_pair_name must be specified. Note that supernodes support only key_pair_name. |
|
image_id |
Yes |
String |
Server image ID. |
|
user_data |
No |
String |
Data defined by users during server creation. |
|
Parameter |
Type |
Description |
|---|---|---|
|
create_at |
Long |
Creation time. |
|
update_at |
Long |
Update time. |
|
charging_mode |
String |
Billing mode.
|
|
cloud_server |
CloudServer object |
Cloud service information. |
|
endpoints_response |
Array of Endpoints objects |
Private IP address of the instance. |
|
flavor |
String |
Instance flavor. |
|
id |
String |
Instance ID. |
|
key_pair_name |
String |
Key pair name. |
|
name |
String |
Instance name. |
|
order_id |
String |
Order ID. |
|
server_image_response |
ServerImageResponse object |
Instance image information. |
|
status |
String |
Instance status.
|
|
vpc_id |
String |
ID of the VPC where the instance is located. |
|
endpoints |
Array of EndpointsRes objects |
Private IP address of the server. |
|
image |
ServerImageResponse object |
Server image information. |
|
category |
String |
Server type.
|
|
server_hps |
ServerHpsInfo object |
Information about the supernode to which the server belongs. |
|
subnet_id |
String |
ID of the subnet where the instance is located. |
|
Parameter |
Type |
Description |
|---|---|---|
|
id |
String |
Server resource ID. |
|
type |
String |
Lite server type. The value can be:
|
|
hps_id |
String |
Resource ID of the supernode to which the server belongs. |
|
Parameter |
Type |
Description |
|---|---|---|
|
allowed_access_ips |
Array of strings |
Whitelist public IP addresses that are allowed to access notebook instances through SSH. By default, all public IP addresses can access the notebook instances. If IP addresses are specified, only the clients with the specified IP addresses can access the notebook instances. |
|
dev_service |
String |
Supported service. The value can be:
|
|
extensions |
Map<String,String> |
App-specific URL for accessing the remote development mode of the App. |
|
ssh_keys |
Array of strings |
List of SSH key pairs. You can set multiple key pairs to access an SSH instance at the same time. |
|
Parameter |
Type |
Description |
|---|---|---|
|
allowed_access_ips |
Array of strings |
Whitelist public IP addresses that are allowed to access notebook instances through SSH. By default, all public IP addresses can access the notebook instances. If IP addresses are specified, only the clients with the specified IP addresses can access the notebook instances. |
|
dev_service |
String |
Notebook access method. The value can be:
|
|
ssh_keys |
Array of strings |
List of SSH key pairs. You can set multiple key pairs to access an SSH instance at the same time. |
|
service |
String |
Notebook access method. The value can be:
|
|
uri |
String |
Private IP address of the instance. |
|
Parameter |
Type |
Description |
|---|---|---|
|
arch |
String |
Server image architecture type.
|
|
image_id |
String |
Server image ID. |
|
name |
String |
Server image name. |
|
server_type |
String |
Server type. The value can be:
|
|
Parameter |
Type |
Description |
|---|---|---|
|
id |
String |
Lite Server supernode instance ID. |
|
name |
String |
Lite Server supernode name. |
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot