You need to enable JavaScript to run this app.
Elastic Compute Service

Elastic Compute Service

Copy page
Download PDF
Cloud assistant
Description of differences between cloud assistant command executions and in-instance command executions
Copy page
Download PDF
Description of differences between cloud assistant command executions and in-instance command executions
This topic mainly describes the differences in command output when you execute commands in Linux-based or Windows-based instances with the cloud assistant and when you execute commands inside the instance.​
Linux-based instances​
​
Differences in the output environment variable information
Differences in command execution results
Differences in the completeness of execution result outputs
​
Difference description​
There are differences between the environment variable information output when you execute commands with the cloud assistant and when you execute them inside the instance.​
Take the execution of the export command as an example:​
  • Output when executing inside the instance​
  • ​​​
  • Output when executing inside the instance​
  • ​​​
Possible causes​
After you log in to the instance via the remote connection software (such as PuTTY and Xshell) or the ECS console remote connection, the system automatically enters an interactive login Shell environment. In this environment, the Shell interpreter (such as, /bin/bash) loads environment configuration and initialization-related startup files (such as /etc/profile, ~/.bash_profile, and ~/.bashrc). These startup files usually contain some environment variables.​
When you execute Shell commands with the cloud assistant, the system does not enter an interactive login Shell environment. Therefore, startup files like /etc/profile, ~/.bash_profile, and ~/.bashrc are not loaded. This causes the cloud assistant to fail to obtain or use the environment variables defined in these startup files.​
Solution​
You can proactively load the required startup files in the cloud assistant.​
  1. Log in to the Cloud Assistant console.​
  1. Create the target cloud assistant command, and add a step to check if the target environment variable exists. For detailed operations, refer to Creating jobs.​
tip​
  • Replace the $USER parameter in the command with the actual environment variable.​
  • Replace the /etc/profile file in the command with the actual startup file.​
  • ​
    #!/bin/bash​
    ​
    if [ -z "$USER" ]; then​
    echo "\$USER is unavailable"​
    source /etc/profile​
    else​
    echo "\$USER is available"​
    fi​
    ​
    export​
    ​
  • Sample output:​
  • As shown in the figure, the cloud assistant has returned details about the $USER parameter.​
  • ​​​
​
Windows-based instances​
​
Difference in NAS mounting
​
Difference description​
In a Windows instance, if you execute the net use L:\\test.nas.com\share command in PowerShell to mount the NAS (Network Attached Storage), you can use the NAS normally after mounting.​
However, if you execute the net use K:\\test.nas.com\share command with the cloud assistant to mount the NAS, you can not use it normally after logging in to the instance. Additionally, the NAS will disappear after the instance restarts.​
Possible causes​
The net use command may run as the System user (a system account). However, the user logs in to the instance remotely as the Administrator user (an admin account) and has no permissions to access the mounted NAS. After the instance restarts, the context (Context) of the cloud assistant Agent, which operates under the System user identity, expires. Therefore, all resources associated with this context are cleared.​
Solution​
Log in to the instance to mount NAS.​
​
Last updated: 2026.01.26 11:12:36