Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Situation Awareness
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive
Help Center/ Virtual Private Cloud/ FAQs/ Connectivity/ Why Can't My ECS Use Cloud-init?

Why Can't My ECS Use Cloud-init?

Updated on 2025-01-17 GMT+08:00

Symptom

An ECS is not able to use cloud-init.

Troubleshooting

Figure 1 shows the process for an ECS to obtain metadata using the cloud-init.
Figure 1 Process for obtaining metadata

Check the following possible causes.

Figure 2 Possible causes
Table 1 Possible causes

Possible Cause

Solution

The ECS has no IP address obtained.

See The ECS Has Not Obtained IP Address

Incorrect route for 169.254.169.254

See Incorrect Route for 169.254.169.254

Fail to obtain the ECS metadata.

See Did Not Obtain the ECS Metadata

Fail to log in to the ECS or create a non-root user after cloud-init is configured.

Check the format of the /etc/cloud/cloud.cfg configuration file. For details, see Cannot Log in to the ECS or Create a Non-root User After Cloud-init Is Configured.

Fail to use an obtained private key to log in to an ECS after the ECS starts (Fail to obtain the ECS login password).

Restart the ECS and try again.

The ECS Has Not Obtained IP Address

Check whether the ECS has obtained an IP address.

If no IP address is obtained, run the dhclient command to obtain the IP address (this command varies depending on the ECS OSs). Alternatively, you can run the ifdown ethx command to disable the network port and then run the ifup ethx command to enable it to allow the ECS's network interface to automatically obtain an IP address again.

Figure 3 ECS IP address

Incorrect Route for 169.254.169.254

Ping 169.254.169.254/32 from the ECS. If the IP address cannot be pinged, perform the following steps:
  1. Check the exact route configured on the ECS for IP address 169.254.169.254/32.

    In most cases, the next hop of the exact route for IP address 169.254.169.254/32 is the same as that of the default route for the IP address.

    Figure 4 Route for IP address 169.254.169.254/32
  2. If there is no exact route for IP address 169.254.169.254/32, the cause is as follows:

    Images with CentOS 5 OSs are not compatible with cloud-init. To use cloud-init, select a different OS.

  3. If the next hop of the exact route for IP address 169.254.169.254/32 is different from that of the default route for the IP address:
    • If the ECS was created before cloud-init was enabled, run service network restart to obtain the correct route.
    • If the ECS is newly created, submit a service ticket or contact technical support.

Did Not Obtain the ECS Metadata

Run the following command on the ECS to obtain the metadata:

curl http://169.254.169.254/openstack/latest/meta_data.json

If information similar to that shown in Figure 5 is displayed, the ECS successfully obtains the metadata.

Figure 5 Command output

Cannot Log in to the ECS or Create a Non-root User After Cloud-init Is Configured

Check whether the /etc/cloud/cloud.cfg configuration file format is correct. For details, see the file format requirements for different Linux distributions. The following figure shows an example /etc/cloud/cloud.cfg configuration file for Ubuntu.

Figure 6 Configuration file

Obtained Private Key Cannot Be Used to Log in to an ECS After the ECS Starts (Failed to Obtain the ECS Login Password)

Restart the ECS to rectify the fault.

Submitting a Service Ticket

If the EIP still fails to use cloud-init after performing the preceding steps, submit a service ticket.

Provide the following information to the technical support engineer.

Item

Description

Example

Value

VPC CIDR block

Required for customer gateway configuration

Example: 10.0.0.0/16

N/A

VPC ID

N/A

Example: 120b71c7-94ac-45b8-8ed6-30aafc8fbdba

N/A

CIDR block of subnet 1 (can be the same as the VPC CIDR block)

N/A

Example: 10.0.1.0/24

N/A

ECS ID

N/A

N/A

N/A

ECS IP address

N/A

Example: 192.168.1.192/24

N/A

ECS route information

N/A

N/A

N/A

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback