Technical documentation on automating Hovixa VPS deployment via the SolusVM 2 API. Learn to generate API tokens, authenticate requests, and programmatically provision KVM instances.

Automating VPS Provisioning Using the SolusVM 2 API

For DevOps engineers and service providers, manual deployment is an inefficient bottleneck. The SolusVM 2 API (available via vm.hovixa.com) allows you to automate the entire lifecycle of a Virtual Private Server—from initial creation and OS selection to power management and resource scaling—using standard RESTful HTTP requests.

1. Generating API Credentials

The SolusVM 2 API uses Personal Access Tokens (PAT) for authentication. Unlike the billing portal API, these tokens are specific to the hypervisor management plane.

  1. Log in to vm.hovixa.com.
  2. Click on your profile icon and select API Tokens.
  3. Click Create Token and provide a descriptive label.
  4. Copy the generated Secret Key immediately. For security, it will never be displayed again.

2. API Authentication & Base URL

All API requests must be sent to the SolusVM 2 endpoint with the Authorization header. The standard format is a Bearer token.

  • Base URL: https://vm.hovixa.com/api/v1
  • Header: Authorization: Bearer YOUR_TOKEN_HERE
  • Content-Type: application/json

3. The Provisioning Request (POST)

To provision a new VPS, you must send a POST request to the /virtual-machines endpoint. You will need the IDs for the Plan, Location, and Image, which can be retrieved via their respective GET endpoints.

Example JSON Payload:

{
  "name": "api-deployed-server",
  "plan_id": 5,
  "location_id": 1,
  "image_id": 10,
  "ssh_key_ids": [123],
  "user_data": "#cloud-config\npackage_update: true\npackages:\n  - docker.io"
}
    

4. Common API Endpoints for Automation

Method Endpoint Action
GET /plans List available CPU/RAM/Disk packages.
POST /virtual-machines/{id}/reboot Trigger an ACPI reboot on a specific VM.
DELETE /virtual-machines/{id} Terminate and decommission a VPS.
GET /virtual-machines/{id}/status Check if the VM is Running, Stopped, or Tasked.

5. Technical Implementation Details

  • Idempotency: When automating, ensure your scripts handle the asynchronous nature of provisioning. A 201 Created response means the *task* was accepted; you must poll the status endpoint until it returns running.
  • Rate Limiting: The API enforces a rate limit to prevent DDoS-like behavior. If you receive a 429 Too Many Requests, implement an exponential backoff in your script.
  • Cloud-Init Injection: The user_data field in your POST request accepts Base64 encoded or raw YAML strings. This is the most powerful tool for "Zero-Touch" deployment, allowing you to hand off a fully configured server to your end-user.

Developer Tip: Use Postman or Insomnia to test your JSON payloads and headers before committing them to your production code. Always verify the image_id matches the architecture (x86_64) of the node you are deploying to.

Ha estat útil la resposta? 0 Els usuaris han Trobat Això Útil (0 Vots)