Back to Cloud VPS Documentation

    OpenStack API Guide

    Automate and manage your cloud resources programmatically

    What is the OpenStack API?

    The OpenStack API is a RESTful HTTP API that allows you to programmatically manage your cloud resources. Instead of using the web control panel, you can write scripts, build automation, or integrate cloud management into your applications.

    RamNode Cloud provides complete OpenStack API compatibility, meaning any tool or library that works with standard OpenStack will work with RamNode Cloud.

    Getting Started with the API

    There are several ways to interact with the OpenStack API:

    • OpenStack CLI - Command-line tools for managing resources
    • Python SDK - Native Python library for OpenStack
    • REST API - Direct HTTP API calls
    • Third-party tools - Terraform, Ansible, and other automation tools

    For most users, we recommend starting with the OpenStack CLI, as it's the easiest way to get started.

    API Endpoints

    RamNode Cloud uses the following API endpoints:

    • Identity (Keystone): https://cloud.ramnode.com:5000/v3
    • Compute (Nova): Available after authentication
    • Network (Neutron): Available after authentication
    • Image (Glance): Available after authentication
    • Block Storage (Cinder): Available after authentication
    • Object Storage (Swift): Available after authentication

    The Identity endpoint is used for authentication. Once authenticated, you'll receive a service catalog with the URLs for all other services.

    Authentication

    Authentication with the OpenStack API uses your Cloud Control Panel credentials. The easiest way is to download your RC file from the control panel:

    1. Log into the Cloud Control Panel
    2. Click your username in the top right
    3. Select OpenStack RC File
    4. Download the Identity API v3 version

    The RC file contains all necessary authentication parameters. When you source it in your terminal, it sets environment variables that the OpenStack CLI automatically uses.

    API Documentation Resources

    RamNode Cloud is fully compatible with the official OpenStack APIs. You can refer to these resources:

    API Capabilities

    The OpenStack API allows you to perform virtually any action available in the web control panel:

    • Instance Management - Create, start, stop, reboot, resize, and delete instances
    • Networking - Manage floating IPs, security groups, and private networks
    • Storage - Create and manage block storage volumes and snapshots
    • Images - Upload custom images, create snapshots, and manage OS templates
    • SSH Keys - Add and manage SSH keys for instance access
    • Metadata - Set custom metadata on instances and resources
    • Monitoring - Retrieve resource usage and performance metrics

    Rate Limits

    API rate limits are set at reasonable levels to prevent abuse while allowing normal automation usage:

    • API calls: 1000 requests per minute per project
    • Instance creation: 50 instances per hour (can be increased)
    • Authentication: 100 login attempts per hour

    For most automation and management tasks, these limits are more than sufficient. If you have a legitimate use case requiring higher limits, contact support to discuss your needs.

    Terraform Integration

    Terraform has a native OpenStack provider that works perfectly with RamNode Cloud. Check out our Terraform deployment guide for detailed instructions.

    Terraform Configuration Example
    terraform {
      required_providers {
        openstack = {
          source = "terraform-provider-openstack/openstack"
        }
      }
    }
    
    provider "openstack" {
      auth_url    = "https://cloud.ramnode.com:5000/v3"
      user_name   = "your-email@example.com"
      password    = "your-password"
      tenant_name = "your-project-name"
      domain_name = "Default"
      region      = "NYC1"
    }
    
    resource "openstack_compute_instance_v2" "web_server" {
      name            = "web-server-01"
      image_name      = "Ubuntu 22.04 LTS"
      flavor_name     = "c1.small"
      key_pair        = "my-ssh-key"
      security_groups = ["default", "web"]
    
      network {
        name = "public"
      }
    }

    Ansible Integration

    Ansible includes OpenStack modules that work with RamNode Cloud. You can use Ansible for both provisioning cloud resources and configuring instances.

    Ansible Playbook Example
    ---
    - name: Create RamNode Cloud instance
      hosts: localhost
      gather_facts: no
      tasks:
        - name: Launch instance
          openstack.cloud.server:
            state: present
            auth:
              auth_url: https://cloud.ramnode.com:5000/v3
              username: your-email@example.com
              password: your-password
              project_name: your-project-name
              user_domain_name: Default
              project_domain_name: Default
            name: ansible-instance
            image: Ubuntu 22.04 LTS
            flavor: c1.small
            key_name: my-key
            network: public
            security_groups:
              - default
              - web

    SDKs and Libraries

    OpenStack has official SDKs for multiple languages:

    Python SDK Example
    import openstack
    
    # Create connection
    conn = openstack.connect(
        auth_url='https://cloud.ramnode.com:5000/v3',
        project_name='your-project',
        username='your-email@example.com',
        password='your-password',
        user_domain_name='Default',
        project_domain_name='Default',
        region_name='NYC1'
    )
    
    # List all instances
    for server in conn.compute.servers():
        print(f"Server: {server.name} - {server.status}")
    
    # Create a new instance
    server = conn.compute.create_server(
        name='python-instance',
        image='Ubuntu 22.04 LTS',
        flavor='c1.small',
        network='public',
        key_name='my-key'
    )
    
    print(f"Created server: {server.id}")

    Error Handling and Debugging

    When working with the API, here are some tips for handling common issues:

    Enable Verbose Output

    # OpenStack CLI with debug output
    openstack --debug server list
    
    # Set debug environment variable
    export OS_DEBUG=1

    Common Error Codes

    • 401 Unauthorized - Invalid credentials or expired token
    • 403 Forbidden - Insufficient permissions
    • 404 Not Found - Resource doesn't exist
    • 409 Conflict - Resource state conflict (e.g., instance already stopped)
    • 429 Too Many Requests - Rate limit exceeded
    • 500 Internal Server Error - Server-side issue (contact support)

    Check API Status

    # Test authentication
    openstack token issue
    
    # Check service endpoints
    openstack catalog list

    Security Best Practices

    • Never hardcode credentials - Use environment variables or secure credential stores
    • Use application credentials - Create limited-scope credentials for applications
    • Rotate passwords regularly - Change your password every 90 days
    • Use HTTPS only - Never disable SSL certificate verification
    • Limit token lifetime - Tokens expire after 12 hours by default
    • Audit API usage - Review logs regularly for unauthorized access
    • Use IP restrictions - When possible, restrict API access by IP address

    Need Help?

    If you encounter issues with the API:

    1. Check the official OpenStack documentation
    2. Review our OpenStack SDK tutorial
    3. Search our documentation
    4. Ask in our Discord community
    5. Contact our support team

    Getting Started: New to the OpenStack API? Start with our OpenStack SDK Tutorial for a step-by-step guide to installing and using the CLI tools.