Tencent Cloud Account with Balance How to Create Custom Image from Tencent Cloud CVM

Tencent Cloud / 2026-05-14 22:05:04

Tencent Cloud Account with Balance Why Custom Images Matter (and Why Your Future Self Will Thank You)

You know that feeling when you rebuild the same server for the third time this month? You start confidently, copy-paste your checklist like a seasoned engineer, and then—surprise—half the checklist is missing because “we’ll remember it next time.” Spoiler: you won’t.

Custom images fix that problem. Instead of creating a snowflake server every time, you build one “golden” machine: properly configured, dependencies installed, agents set up, and maybe even a tasteful background image that says, “I’m responsible.” Then you capture it as a custom image. After that, deploying new CVM instances becomes far less of a ritual sacrifice and far more of a repeatable process.

In this article, we’ll walk through how to create a custom image from Tencent Cloud CVM in a clear and practical way. We’ll cover preparation, cleanup, configuration, image creation, and deploying from that image later. We’ll also address the common “why is my new instance haunted?” issues that show up when you clone systems without thinking about identity, disks, and network settings.

Let’s build your golden image—one step at a time.

Before You Start: What “Custom Image” Actually Means

A custom image is a reusable template you can use to create new CVM instances. Instead of deploying from a standard base image (like a default Linux distribution), you take your current CVM, make it into the exact environment you want, and then capture it as an image.

When the cloud deploys a new instance from your custom image, the instance boots from that saved snapshot of your configured system. That means your packages, configuration files, and installed software are already there—assuming you cleaned and configured things correctly.

Think of it like baking a cake. The base image is flour and sugar. Your custom image is the cake with frosting, sprinkles, and a suspicious number of candles you probably didn’t need. Next time, you can bake another cake without repeating the entire recipe from scratch.

High-Level Roadmap

Here’s the game plan. You’ll:

  • Choose the CVM you want to transform into a golden image.
  • Prepare the OS: update packages, install dependencies, configure services.
  • Clean up: remove temporary files, logs, caches, and sensitive leftovers.
  • Configure identity/network/agents carefully to avoid cloned-badness.
  • Create the custom image in Tencent Cloud.
  • Test by launching a new instance from that image.
  • Tune your process for repeatability and versioning.

Now, let’s get practical.

Step 1: Pick the Right CVM to Capture

Start with a CVM that is stable and representative of the environment you want to reproduce. This should ideally be your “builder machine,” where you do all the configuration work.

Key considerations:

  • OS choice: Stick to one OS flavor and version if possible. Mixed versions lead to chaos.
  • Disk layout: Know what you’re capturing. If your environment uses special partitions, document it.
  • Resource sizing: While the image itself is reusable, the CVM you create from it will need appropriate CPU/RAM/disk settings for your workloads.
  • Network assumptions: Avoid hardcoding IP addresses or other network-specific settings into your image.

If this CVM will be used as a base for web servers, you’ll likely want common web stack components installed. If it’s for workers, you’ll want job runners and monitoring agents. The goal is to capture “setup,” not “state.”

Step 2: Prepare Your System (Install What You Actually Need)

Now you configure the OS the way you want it. This is the part where many people either overshoot or undershoot. Overshoot means you bake in everything under the sun. Undershoot means your image boots, but then your apps immediately faceplant because the dependencies aren’t there.

Here’s a sensible checklist:

  • Apply OS updates and security patches.
  • Install required packages (language runtimes, databases, CLI tools, etc.).
  • Configure system settings (timezone, locale, kernel parameters if relevant).
  • Set up environment variables and service configuration files.
  • Tencent Cloud Account with Balance Enable and start essential services.
  • Set up monitoring/logging agents if your org uses them.

Practical tip: Write down what you install and why. Future-you will want to know whether that mysterious package exists for a reason or because someone clicked “Next” too quickly.

Step 3: Clean Up the Image (Make It Lean, Not Haunted)

A custom image should generally be clean. If you capture a system loaded with gigabytes of junk, your image becomes slower, larger, and less pleasant to manage.

Common cleanup targets:

  • Temporary files (e.g., /tmp, package manager caches).
  • Log files that only matter for this builder instance.
  • Old package metadata or cache folders.
  • Leftover SSH host keys or configuration that ties to the original instance identity (more on this next).

The exact commands depend on your OS, but the principle is universal: remove stuff that is instance-specific or that will just waste space in your image.

Also, do not wipe everything blindly. Some logs might be useful during early debugging. But if you’re capturing a “golden” template, you probably don’t need the logs from your builder binge.

Step 4: Identity and Security Considerations (The “Clone Problems” Section)

Here’s where things often go wrong. When you create an image from an existing machine, certain “identity” pieces may get copied as-is. That can cause conflicts when multiple instances are launched from the same custom image.

Typical identity items include:

  • SSH host keys: If they’re copied, clients may see mismatch warnings or unusual behavior.
  • Machine ID / system UUID: Some OSes store unique identifiers used by services.
  • Agent registration state: Monitoring agents sometimes register to a specific host and may need re-registration.
  • Tencent Cloud Account with Balance Network configuration: Avoid static IPs, and be careful with hostname assumptions.
  • Application state: Don’t accidentally bake in caches, secrets, or environment-specific data.

Tencent Cloud Account with Balance What should you do?

  • Prefer templates that generate or renew identity on first boot.
  • For security, ensure you’re not including sensitive credentials in the image.
  • If you use an agent, confirm whether it can re-register itself automatically after deployment.

In many setups, you’ll implement a “first boot” script that reinitializes identity and restarts services cleanly. If your organization already has a standard approach for golden images, follow it. If not, consider creating a simple init mechanism that runs when a new instance launches.

And yes, you should double-check that you didn’t store secrets in your shell history. That’s not a joke; it’s tradition.

Step 5: Configure “First Boot” Behavior (Optional but Highly Recommended)

You can build an image that works immediately, but it’s even better when each new instance initializes itself properly.

Conceptually, first boot behavior does things like:

  • Generate fresh SSH host keys if needed.
  • Recreate machine ID (where applicable).
  • Restart services so they pick up the new host’s environment.
  • Run a registration step for monitoring/management agents.
  • Fetch configuration or secrets from a secure location (if your pipeline supports it).

Where to implement this depends on the OS. Common approaches include cloud-init or systemd units triggered at boot. If your base image includes a mechanism for initialization, use it. If not, add a minimal script designed specifically for cloned instances.

The goal is to ensure that launching an instance from your image results in a clean, unique identity rather than a copy of your builder’s identity.

Step 6: Verify Services and Health Before Capturing

Before you press the “capture” button (figuratively; you know there are confirmations and you will read them this time), you should verify the system is healthy.

Do the basic checks:

  • Confirm required services are running.
  • Test your main application endpoints or health checks.
  • Confirm that firewall rules (if any) allow expected traffic.
  • Check that your system can resolve DNS properly.
  • Verify the system logs aren’t full of errors that you’d rather not repeat on every clone.

If your golden machine can’t start its own heartbeat, your cloned machines won’t either. They will just do it faster.

Step 7: Create the Custom Image in Tencent Cloud Console

Now we enter the cloud portion of the journey. Tencent Cloud provides the ability to create custom images from CVM instances.

While the exact UI labels can vary slightly depending on your console version and region, the process generally looks like this:

  • Go to the Tencent Cloud console.
  • Open the CVM (Elastic Compute) section.
  • Find and select the instance you prepared.
  • Look for an option related to creating an image, such as “Create Image” or “Create Custom Image.”
  • Choose parameters like image name, description, and whether to include the system disk.
  • Confirm and submit the image creation request.

During image creation, Tencent Cloud will capture the disk state according to the options you choose. You may need to wait for the image to become available.

Here are practical tips for naming and organizing your image:

  • Name it clearly: Include OS version, application stack version, and a date or build number.
  • Use descriptions: Briefly list what’s included and any special assumptions.
  • Tencent Cloud Account with Balance Version it: Treat image versions like software releases.

Example naming style: “ubuntu-22.04-webstack-2026-05-14-v3”. It looks nerdy, but it saves hours later.

Step 8: Wait for the Image to Finish Creating

Image creation can take some time, depending on disk size, image settings, and current platform load.

During this time, avoid unnecessary tinkering with the builder instance. You want the captured state to match the configured environment you tested. If you absolutely must do more changes, it’s usually safer to postpone capturing until everything is correct.

When the image becomes available, you’ll typically see it listed in your custom images area or within an image management section.

Step 9: Launch a New CVM Instance from Your Custom Image (The “Don’t Trust, Verify” Phase)

Creating a custom image is only half the job. The other half is launching an instance from it and confirming that everything works as expected.

To test:

  • Go to the CVM creation flow.
  • Select your custom image instead of a default base image.
  • Choose suitable instance type and disk settings.
  • Configure networking, security groups, and access method.
  • Launch the instance and wait for it to boot.

Then verify:

  • OS boots without errors.
  • Tencent Cloud Account with Balance Expected services start automatically.
  • Your app endpoints respond correctly (or at least your health checks do).
  • Identity-related pieces behave properly (no SSH host key conflicts, correct hostname behavior, etc.).

If the new instance behaves differently than your builder machine, don’t panic. Instead, investigate whether you need first-boot reinitialization, different network configuration, or agent re-registration.

Troubleshooting: When Your Image Works… Sort Of

Here are some common problems people hit after building custom images, and what to do about them.

Problem 1: SSH warnings about changed host keys

If clients report that the host key changed, it’s because the SSH host keys were likely captured from the builder instance and reused in the clone.

Fix approach:

  • Implement a first-boot step to regenerate SSH host keys.
  • Or ensure the base image already does this automatically.

Bonus: Make sure your automation doesn’t attempt to “trust on first use” blindly. That’s how you end up trusting the wrong thing.

Problem 2: Monitoring or agent shows the wrong host

Many agents register to an ID at installation time. When you clone, they might still think they’re the original host.

Fix approach:

  • Check agent documentation for re-registration or “machine ID” behaviors.
  • Add first-boot logic to force agent re-enrollment.
  • Make sure the agent reads environment variables or host identity freshly.

Problem 3: Services fail to start after cloning

Sometimes services rely on instance-specific files, paths, or environment variables.

Fix approach:

  • Look at system logs for the failing services.
  • Check for hardcoded absolute paths or hostnames.
  • Ensure dependencies are installed and enabled.
  • Restart services on first boot.

Remember: clones are good at being copies, but they’re terrible at being adaptable unless you teach them how.

Problem 4: Disk sizing mismatch or missing partitions

Your builder instance might have different disk layout than your target instance type.

Fix approach:

  • Keep disk layouts consistent across builds.
  • Document which disk(s) your image captures (system disk only vs additional disks).
  • Use resizing or partition expansion automation if needed.

Problem 5: Network configuration doesn’t match

Hardcoded IP addresses are the villain of custom images.

Fix approach:

  • Use DHCP or dynamic config where appropriate.
  • Avoid hardcoding IP/hostname in configuration files.
  • If you must use static settings, do it at deployment time, not in the image.

Best Practices for Managing Custom Images Like a Grown-Up

Let’s make this sustainable. Golden images are amazing, but only if you treat them like a product.

1) Version and label everything

Whenever you update packages or configuration, build a new custom image version. Don’t overwrite your only copy unless you enjoy archaeology.

Use image names that tell you:

  • OS version
  • Application stack version
  • Date and build number
  • Whether it includes optional components

2) Keep images focused (single purpose beats “kitchen sink”)

If your company has multiple server roles, create separate images for each role. Don’t make one mega-image that includes everything and then wonder why it’s 80 GB and takes forever to deploy.

Smaller images are easier to test and faster to roll out.

3) Automate your image build process

The ideal workflow is:

  • Provision builder CVM automatically (infrastructure-as-code).
  • Run configuration scripts.
  • Run cleanup and identity-prep steps.
  • Capture image.
  • Test by deploying a fresh instance.

This turns custom image building into a pipeline instead of a manual adventure. And it prevents “I did it by memory” from becoming your primary deployment strategy.

4) Document your assumptions

Examples of assumptions you should document:

  • Whether the image expects certain ports to be open via security groups.
  • Whether it uses a specific container runtime version.
  • Whether first-boot scripts are present and what they do.
  • What user account(s) exist and whether password login is allowed.

Future-you loves documentation almost as much as future-you loves not having to debug “it works on my machine” disasters.

A Humorous Checklist Before You Hit “Create Image”

Tencent Cloud Account with Balance Let’s end with a checklist that’s equal parts serious and silly. Imagine a coworker taped this to your monitor:

  • All required software installed? (Not “mostly.” Not “I think.” Actually yes.)
  • Temporary files and caches cleaned? (Your image should not be stuffed like a warehouse.)
  • Instance-specific identity handled? (SSH keys, machine ID, agents.)
  • No secrets baked into the image? (If you need a password, your image is doing it wrong.)
  • Services verified running on the builder instance?
  • Test plan ready for the cloned instance?
  • Image name includes version/date so you can find it later without crying?

If you can answer all of those with confidence, you’re doing it right. If you can’t, you’ll still survive—but your next troubleshooting session might come with snacks.

Conclusion: Turn One Good Setup into Many Great Instances

Creating custom images from Tencent Cloud CVM is one of those cloud skills that feels boring until it saves you hours. Then it becomes one of your favorite tools. By preparing a golden CVM carefully, cleaning up the right things, handling identity/agent behavior, and testing clones after capturing the image, you can build a reliable deployment foundation.

Once you have custom images working smoothly, your team can iterate faster: update the golden image, test a new clone, and roll out changes consistently. No more “rebuild the server from scratch” marathons. Instead, you get repeatable environments and fewer surprises.

So go forth and build your custom image. Your future deployments are already warming up the server racks—metaphorically, of course, because the servers don’t actually warm up until you launch them. Unless you’ve angered them with an oversized disk capture. In that case, apologies to the servers are recommended.

TelegramContact Us
CS ID
@cloudcup
TelegramSupport
CS ID
@yanhuacloud