Found 0 result in total
Content is empty
If you don't find the content you expect, please try another search term
Last updated:2021-08-04 11:26:31
When creating a KEC instance, you can specify an executable custom data script and configure the instance to, for example, download, upgrade, and install software, modify system configuration, and initialize the service environment.
Custom data supports many types of common scripts, such as shell scripts.
Image support
Standard images: The function can be normally used on KEC instances created in data centers in CN North 1(Beijing), CN East 1(Shanghai), and CN South 1(Guangzhou) after November 1, 2019. It is not supported for data centers in Hong Kong, Singapore, and Russia at present.
Custom images and shared images: The function can be normally used when you use custom images or shared images that are based on KEC instances created after October 30, 2019.
To use custom data for custom images or shared images that do not meet the above conditions, refer to Install the cloud-init service.
The script used in this topic is an example that writes the instance startup time and specified text to the output.txt
file.
Prepare a shell script.
#!/bin/bash
echo "Hello World. The time is now $(date -R)!" | tee /root/output.txt
service httpd start
chkconfig httpd on
Log in to the KEC console. When you create an instance, click Advanced Options in the System Configuration step.
For more information about creating an instance, see Create an instance.
In (Optional) Custom Data, enter the prepared shell script.
The parameter also supports Base64 encoding format. If the entered script is Base64 encoded, you must also select The input content has been encoded in Base64..
After the instance is created, log in to the instance and verify the execution of the script.
Pure Mode