Apache Libcloud driver for Kamatera
Installation
- Install Libcloud (Version 2.8.2 or higher)
- Install the driver, using the same Python interpreter that Libcloud was installed in:
pip install libcloud-driver-kamatera
Usage
Enabling API access
To allow API access to your Kamatera account, you first need to add an API key by visiting Kamatera Console and adding a new key under API Keys. Use the created key Client ID and Secret as the arguments to the driver constructor.
Instantiating a driver
from libcloud_driver_kamatera import get_node_driver
cls = get_node_driver()
driver = cls('KAMATERA API CLIENT ID', 'KAMATERA API SECRET')
Getting server options
Select a location
locations = {location.id: location for location in driver.list_locations()}
for location in locations.values():
print(location)
# <NodeLocation: id=AS, name=Hong Kong, country=China
# <NodeLocation: id=CA-TR, name=Toronto, country=Canada
# <NodeLocation: id=EU, name=Amsterdam, country=The Netherlands
# <NodeLocation: id=EU-FR, name=Frankfurt, country=Germany
# <NodeLocation: id=EU-LO, name=London, country=United Kingdom
# <NodeLocation: id=IL, name=Rosh Haayin, country=Israel
# <NodeLocation: id=IL-JR, name=Jerusalem, country=Israel
# <NodeLocation: id=IL-PT, name=Petach Tikva, country=Israel
# <NodeLocation: id=IL-RH, name=Rosh Haayin 2, country=Israel
# <NodeLocation: id=IL-TA, name=Tel Aviv, country=Israel
# <NodeLocation: id=US-NY2, name=New York, country=United States
# <NodeLocation: id=US-SC, name=Santa Clara, country=United States
# <NodeLocation: id=US-TX, name=Texas, country=United States
location = locations['US-NY2']
Create a node size object
# get the capabilities for this location
capabilities = driver.ex_list_capabilities(location)
# choose a cpu type
cpuTypes = {cpuType['id']: cpuType for cpuType in capabilities['cpuTypes']}
for cpuType in cpuTypes.values():
print('%s: %s' % (cpuType['name'], cpuType['description']))
# Type B - General Purpose: Server CPUs are assigned to a dedicated physical
# CPU Thread with reserved resources guaranteed.
# Type D - Dedicated: Server CPU are assigned to a dedicated physical CPU Core
# (2 threads) with reserved resources guaranteed.
# Type T - Burstable: Server CPUs are assigned to a dedicated physical CPU
# thread with reserved resources guaranteed.
# Type A - Availability: Server CPUs are assigned to a non-dedicated physical
# CPU thread with no resources guaranteed.
cpuType = cpuTypes['B']
# choose number of cpu cores
print(cpuType['cpuCores'])
# [1, 2, 4, 6, 8, 12, 16, 20, 24, 28, 32, 36, 40, 48, 56, 64, 72]
cpuCores = 2
# choose amount of RAM
print(cpuType['ramMB'])
# [256, 512, 1024, 2048, 3072, 4096, 6144, 8192, 10240, 12288, 16384, 24576,
# 32768, 49152, 65536, 98304, 131072, 200704, 262144, 327680, 393216]
ramMB = 2048
# choose disk sizes
print(capabilities['diskSizeGB'])
# [5, 10, 15, 20, 30, 40, 50, 60, 80, 100, 150, 200, 250, 300, 350, 400, 450,
# 500, 600, 700, 800, 900, 1000, 1500, 2000, 3000, 4000]
# primary disk size
diskSizeGB = 20
# additional disks (up to 3 additional disks)
extraDiskSizesGB = [100, 200]
# choose a billing cycle
billingCycle = driver.EX_BILLINGCYCLE_MONTHLY
# billingCycle = driver.EX_BILLINGCYCLE_HOURLY
# in case of monthly billing cycle, choose traffic package
print(capabilities['monthlyTrafficPackage'])
# {'b50': '50Mbit/sec unmetered on 10Gbit/sec port',
# 't5000': '5000GB/month on 10Gbit/sec port'}
monthlyTrafficPackage = 't5000'
# create node size object
size = driver.ex_get_size(ramMB, diskSizeGB, cpuType['id'], cpuCores,
extraDiskSizesGB=extraDiskSizesGB,
monthlyTrafficPackage=monthlyTrafficPackage)
Choose an OS image
images = {image.id: image for image in driver.list_images(location)}
for image in images.values():
print('%s: %s' % (image.id, image.name))
# list is shortened, actual list will vary and provide more OS image options
# US-NY2:6000C2987c9641fd2619a149ba2ca01a: CentOS 8.0 64-bit - Minimal
# US-NY2:6000C29b85c6367d215d403f44c28f48: CentOS 8.0 64-bit - Basic Server
# US-NY2:6000C29bb8fde673f515caf9bed695a1: Debian version 8.9 (jessie) 64-bit
# US-NY2:6000C29e4131d66b806c25c48ab0b810: FreeBSD 12.1 64-bit
# US-NY2:6000C2983bdd8b531ecfc6d892a35aa4: FreeBSD 11.1 32-bit
# US-NY2:6000C29a5a7220dcf84716e7bba74215: Ubuntu Server version 18.04 LTS
# US-NY2:6000C298bbb2d3b6e9721f4f4f3c5bf0: Ubuntu Server version 16.04 LTS
image = images['US-NY2:6000C29a5a7220dcf84716e7bba74215']
Set network configurations (up to 4 interfaces can be added)
networks = []
Add a wan to get a public IP
networks.append({'name': 'wan', 'ip': 'auto'})
add a vlan interface to get a private IP (vlan network name and ip should be configured in the Kamatera console)
networks.append({'name': '12345-my-vlan', 'ip': 'auto'})
Create a server
node = driver.create_node(
name='test_libcloud_server',
size=size,
image=image,
location=location,
ex_networks=networks,
ex_dailybackup=False, # create daily backups for the node?
ex_managed=False, # provide managed support for the node?
ex_billingcycle=billingCycle
)
Get the SSH connection details
print('root@%s / %s' % (node.public_ips[0],
node.extra['generated_password']))
Server operations
List all nodes (quick operation, provides only basic details for each node)
nodes = driver.list_nodes()
Get more details for a specific node
node = driver.list_nodes(ex_id=nodes[0].id)[0]
print(node)
List nodes with full details based on regex of node name
nodes = driver.list_nodes(ex_name_regex='test_libcloud.*')
print(nodes[0])
# <Node: uuid=9566552b254b42063e87ba644a982d330602b06c,
# name=test_libcloud_server, state=RUNNING,
# public_ips=['138.128.241.118'], private_ips=[], provider=Kamatera
print(nodes[0].extra)
# {'billingcycle': 'monthly', 'priceOn': '25', 'priceOff': '25',
# 'location': <NodeLocation: id=US-NY2>, 'dailybackup': False,
# 'managed': False}
list all nodes with full details (slower operation)
nodes = driver.list_nodes(ex_full_details=True)
node = nodes[0]
run operations
driver.start_node(node)
driver.stop_node(node)
driver.reboot_node(node)
driver.destroy_node(node)
Metadata
Release files for libcloud-driver-kamatera 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| libcloud_driver_kamatera-0.0.2.tar.gz | 11.9 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| libcloud_driver_kamatera-0.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 22.5 kB
Release files / libcloud_driver_kamatera-0.0.2.tar.gz
| Download URL | libcloud_driver_kamatera-0.0.2.tar.gz |
|---|---|
| Size | 11.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
22ccc1d50289c3689035c757f73d7ddbdb0ad50929dcc073e1ae4292b701176d
|
|
BLAKE2b-256 checksum How to use checksums |
dc5f9bb0b4280671eab89c5c72a03b958d70d05702429e79b8bfe5513cd49714
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.6.9
|
Release files / libcloud_driver_kamatera-0.0.2-py3-none-any.whl
| Download URL | libcloud_driver_kamatera-0.0.2-py3-none-any.whl |
|---|---|
| Size | 10.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bae2f09312ee5c43bcfe5501b29ffaff43bc82b020ae171b4b26859943c9859d
|
|
BLAKE2b-256 checksum How to use checksums |
b18466db37b52a561bdfb234cfd07c3c5be992614d142dc47bd51f94e2b7f15d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.6.9
|
Security for libcloud-driver-kamatera 0.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.