This topic describes how to configure user data by using the console.

Background information

When you configure user data, take note of the following points:
  • You can configure user data only for VPC-type instances.
  • If an instance is of a phased-out instance type, the instance must be I/O optimized. This limit does not apply to instance types that are not phased-out. For more information, see Phased-out instance types and Instance families.
  • The size of user data cannot exceed 16 KB before it is encoded in Base64.
    Note The user data must be Base64-encoded before it can be configured. If you do not use the Base64 encoding service provided by the ECS console, you must manually convert the user data to Base64-encoded data before you configure it.
  • The instance must use a public image or a custom image derived from a public image. The following table lists the operating systems that are supported.
    Platform Operating system
    Windows Windows Server 2008 R2 and later
    Linux
    • CentOS
    • Ubuntu
    • SUSE Linux Enterprise
    • OpenSUSE
    • Debian
    • Alibaba Cloud Linux

Procedure

  1. Create a Linux instance. For more information, see Create an instance by using the provided wizard.
    When you create the instance, enter user data in the User Data field of the Advanced (based on instance RAM roles or cloud-init) section. If your user data is already Base64-encoded, select Enter Based64 Encoded Information.
  2. After the instance is started, connect to the instance. For more information, see Overview.

    When the instance is in the Running state, the system will run the user data by using the root permission. Then the system will run the initialization scripts in the /etc/init folder.

  3. View execution results based on your configured user data.
    If a failure occurs, you must check the relevant log files. The following figure shows an example result generated from user data configured by using the Upstart Job script on a CentOS instance.

    In the preceding output, the part-001.conf startup job file is generated in the /etc/init folder.