Powershell Module

Concepts

The IONOS Powershell module wraps the ProfitBricks Cloud API, allowing you to interact with it from a command-line interface.

Getting Started

Before you begin you will need to have signed up for a IONOS account. The credentials you establish during sign-up will be used to authenticate against the ProfitBricks Cloud API.

Installation

Profitbricks Powershell Module requires .NET Framework 4.5 or higher. You can download .NET Framework version 4.5 from here.

This PowerShell module also requires PS version 5.0 or newer. This should be available on your system if you are running Windows 8.1, Windows Server 2012 R2, or newer versions of the Windows operating system. If you are using at least Powershell 2.0, then you should be able to see the currently installed version by running:

PS C:\> $PSVersionTable.PSVersion

Major  Minor  Build  Revision
-----  -----  -----  --------
5      1      15063  674

That example output was taken from a fully patched Windows 10 Professional installation. (October 2017)

Download the ProfitBricks.zip file. Before extracting the files, you may need to "Unblock" the file, as shown in these two screenshots. Right-click the file and look at its properties.

Check to see if your OS is displaying the warning that is highlighted in the following screenshot:

ProfitBricks.zip Properties Unblock

ProfitBricks.zip Properties Unblock

If the "Security: This file came from another computer and might be blocked to help protect this computer." warning is present, then check the "Unblock" box and press "Apply" or "OK". The properties should change and resemble this screenshot:

ProfitBricks.zip Properties Unblocked

ProfitBricks.zip Properties Unblocked

Now you can proceed to unzip the ProfitBricks.zip.

Use one of the following options to make the module available inside PowerShell:

  1. Place the resulting folder ProfitBricks in %USERPROFILE%\Documents\WindowsPowerShell\Modules\ to automatically load the module on PowerShell start for a specific user.
  2. Place the resulting folder ProfitBricks in %SYSTEMROOT%\System32\WindowsPowerShell\v1.0\Modules\ to make the module available system-wide (not recommended).
  3. Place the resulting folder ProfitBricks in the folder of your choice and add that folder to the environment variable PSModulePath to make the module available system-wide. You can see the current values of that variable by running $env:PSModulePath

If the module is not loading automatically, you may run Import-Module Profitbricks to explicitly load it.

You can verify that the module has loaded by looking at the output of Get-Module, or specifically Get-Module Profitbricks:

PS C:\> Get-Module Profitbricks

ModuleType Version    Name               ExportedCommands
---------- -------    ----               ----------------
Binary     1.1.1.0    Profitbricks       {Connect-PBVolume, Disconnect-PBVolume, Get-PBAttachedVolu...

Configuration

Before using the ProfitBricks Powershell module to perform any operations, we need to set our credentials:

If you are planning to use the module interactively, then you can have the system prompt you for your credentials. Launch a PowerShell window, and run:

Set-ProfitBricks -Credential (Get-Credential)

A dialog window should pop up and you can enter your username (username@domain.tld) and your password. If authentication succeeds, you should see:

Authorization successful

If there was an error authenticating, PowerShell should let you know with a message similar to this:

At line:9 char:1
+ Set-Profitbricks $credentials
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : AuthenticationError: (:) [Set-Profitbricks], Exception
    + FullyQualifiedErrorId : 406,Profitbricks.SetProfitbricks

If you want to supply the credentials directly in a script, these lines should accomplish that task. Please Note: Storing credentials in your code is NOT a best practice.

$username = "USERNAME"
$password = "PASSWORD" | ConvertTo-SecureString -AsPlainText -Force
$credentials = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $username, $password
Set-ProfitBricks -Credential $credentials

After successful authentication the credentials will be cached locally for the remainder of the PowerShell session.

Usage

These examples assume that you do not have any resources provisioned under your account. The first thing we will want to do is create a data center to hold all of our resources.

Create Data Center

We need to supply some parameters to get our first data center created. In this case, we will set the location to us/las. Other valid locations can be determined by reviewing the Cloud API documentation or using the Get-PBLocation cmdlet.

>$datacenter =  New-PBDatacenter -Name "Example datacenter" -Description "Example description" -Location "us/las"
>$datacenter

Which will return output similar to:

Id         : dbe936f8-a536-49c5-b864-cec842e3ee65
Type       : datacenter
Href       : https://api.profitbricks.com/cloudapi/v4/datacenters/dbe936f8-a536-49c5-b864-cec842e3ee65
Metadata   : class DatacenterElementMetadata {
               CreatedDate: 5/5/2016 10:38:28 AM
               CreatedBy: user@domain.tld
               Etag: 75c469dc35faf7223943f4c6fe6d0689
               LastModifiedDate: 5/5/2016 10:38:28 AM
               LastModifiedBy: user@domain.tld
               State: BUSY
             }

Properties : class DatacenterProperties {
               Name: Example datacenter
               Description: Example description
               Location: us/las
               Version:
             }

Entities   :
Request    : https://api.profitbricks.com/cloudapi/v4/requests/d2cee0fc-a984-4d88-b56e-68203ad61660/status

We have successfully provisioned a new data center.

Notice the "Id" which was returned. That UUID (dbe936f8-a536-49c5-b864-cec842e3ee65) was assigned to our new data center and will be needed for other operations. The "RequestID" that was returned can be used to check on the status of any create or update operations.

Get-Datacenter -DataCenterId [dbe936f8-a536-49c5-b864-cec842e3ee65]

Create Server

Next we will create a server in the data center. This time we have to pass the 'Id' for the data center, along with some other relevant properties (processor cores, memory, boot volume or boot CD-ROM) for the new server.

$server = New-PBServer -DataCenterId [UUID] -ImageId [UUID] -Cores 1 -Ram 1gb -Name test1234 -PublicIp $true -StaticIp $true -Verbose
$server
VERBOSE: Creating the server...
VERBOSE: Creating the volume...
VERBOSE: Creating the static IP address
VERBOSE: Creating the nic.

Id         : 5bcba46e-47cc-42fa-9c7d-52852088c5b5
Type       : server
Href       : https://api.profitbricks.com/cloudapi/v4/datacenters/e12e545e-1f27-4cb0-87ac-97078dbb9923/servers/5bcba46e-47cc-42fa-9c7d-52852088c5b5
Metadata   : class DatacenterElementMetadata {
               CreatedDate: 5/11/2016 10:51:11 AM
               CreatedBy: user@domain.tld
               Etag: 23732a5ff98b1b9873f19e520730d553
               LastModifiedDate: 5/11/2016 10:51:11 AM
               LastModifiedBy: user@domain.tld
               State: AVAILABLE
             }

Properties : class ServerProperties {
               Name: test1234
               Cores: 1
               Ram: 1024
               AvailabilityZone: AUTO
               VmState: RUNNING
               BootCdrom:
               BootVolume:
             }

Entities   : class ServerEntities {
               Cdroms: class Cdroms {
               Id: 5bcba46e-47cc-42fa-9c7d-52852088c5b5/cdroms
               Type: collection
               Href: https://api.profitbricks.com/cloudapi/v4/datacenters/e12e545e-1f27-4cb0-87ac-97078dbb9923/servers/5bcba46e-47cc-42fa-9c7d-52852088c5b5/cdroms
               Items: System.Collections.Generic.List`1[Model.Image]
             }

               Volumes: class AttachedVolumes {
               Id: 5bcba46e-47cc-42fa-9c7d-52852088c5b5/volumes
               Type: collection
               Href: https://api.profitbricks.com/cloudapi/v4/datacenters/e12e545e-1f27-4cb0-87ac-97078dbb9923/servers/5bcba46e-47cc-42fa-9c7d-52852088c5b5/volumes
               Items: System.Collections.Generic.List`1[Model.Volume]
             }

               Nics: class Nics {
               Id: 5bcba46e-47cc-42fa-9c7d-52852088c5b5/nics
               Type: collection
               Href: https://api.profitbricks.com/cloudapi/v4/datacenters/e12e545e-1f27-4cb0-87ac-97078dbb9923/servers/5bcba46e-47cc-42fa-9c7d-52852088c5b5/nics
               Items: System.Collections.Generic.List`1[Model.Nic]
             }

             }

Request    :

Update Server

Whoops, we didn't assign enough memory to our instance. Let's go ahead and update the server to increase the amount of memory it has assigned. We will need the DataCenterId, the ID of the server we are updating, and the parameters we want to change.

$server = Set-PBServer -DataCenterId $datacenter.Id -ServerId $server.Id -Ram 1024
$server.Properties.Ram
1024

List Servers

Let's take a look at the list of servers in our data center. There are a few more listed here for demonstration purposes.

Get-PBServer -DataCenterId dbe936f8-a536-49c5-b864-cec842e3ee65 | Format-Table

Id                                   Type   Href
--                                   ----   ----
cf2b3019-351c-438b-a5f8-b4f323fc9f23 server https://api.profitbricks.com/cloudapi/v4/datacenters/dbe936f8-a536-49c5-b864-cec842e3ee65/servers/cf2b3019-351c-438b-a5f8-b4f32...
3e7c254f-aeb6-481e-a594-1267cc19cac5 server https://api.profitbricks.com/cloudapi/v4/datacenters/dbe936f8-a536-49c5-b864-cec842e3ee65/servers/3e7c254f-aeb6-481e-a594-1267c...

Create Volume

Now that we have a server provisioned, it needs some storage. We will specify a size for this storage volume in GB as well as set the bus and licencetype.

  • The bus setting can have a serious performance impact. You will want to use VIRTIO when possible. Using VIRTIO may require drivers to be installed depending on the OS you plan to install.
  • The licencetype impacts billing rate, as there is a surcharge for running certain OS types.
$volume = New-PBVolume -DataCenterId $datacenter.Id -Size 5 -Type HDD -ImageId 646023fb-f7bd-11e5-b7e8-52540005ab80 -Name "test_volume"
$volume | Format-Table

Id                                   Type   Href
--                                   ----   ----
12629ab1-20e4-4751-9d92-94986d424eec volume https://api.profitbricks.com/cloudapi/v4/datacenters/dbe936f8-a536-49c5-b864-cec842e3ee65/volumes/12629ab1-20e4-4751-9d92-94986...

Attach Volume

The volume we created is not yet connected or attached to a server. To accomplish that, use the dcid and serverid values returned from the previous commands:

$attachedvolume = Connect-PBVolume -DataCenterId $datacenter.Id -ServerId $newServer.Id -VolumeId $volume.Id
$attachedvolume | Format-Table

Id                                   Type   Href
--                                   ----   ----
12629ab1-20e4-4751-9d92-94986d424eec volume https://api.profitbricks.com/cloudapi/v4/datacenters/dbe936f8-a536-49c5-b864-cec842e3ee65/volumes/12629ab1-20e4-4751-9d92-94986...

List Volumes

Let's take a look at all the volumes in the data center:

Get-PBVolume -DataCenterId $datacenter.Id | Format-Table

Id                                   Type   Href
--                                   ----   ----
12629ab1-20e4-4751-9d92-94986d424eec volume https://api.profitbricks.com/cloudapi/v4/datacenters/dbe936f8-a536-49c5-b864-cec842e3ee65/volumes/12629ab1-20e4-4751-9d92-94986...

Create Snapshot

If we have a volume we would like to keep a copy of, perhaps as a backup, we can take a snapshot:

New-PBSnapshot -DatacenterId $datacenter.Id -VolumeId $newvolume.Id -Name "test snapshot"

List Snapshots

Here is a list of the snapshots in our account:


$snapshots = Get-PBSnapshot
$snapshots| Format-Table

Id                                   Type     Href                                                                                Metadata
--                                   ----     ----                                                                                --------
91c0a13b-2bc3-4628-851f-7f30c34997f9 snapshot https://api.profitbricks.com/cloudapi/v4/snapshots/91c0a13b-2bc3-4628-851f-7f30c34997f9 class DatacenterElementMetadata {...
c46f5183-7ee4-4317-ab2a-e9320eac57d6 snapshot https://api.profitbricks.com/cloudapi/v4/snapshots/c46f5183-7ee4-4317-ab2a-e9320eac57d6 class DatacenterElementMetadata {...

Update Snapshot

Now that we have a snapshot created, we can change the name to something more descriptive:

Set-PBSnapshot -SnapshotId $snapshots.Item(0).Id -Name "new_name"

Delete Snapshot

We can delete our snapshot when we are done with it:

Remove-PBSnapshot -SnapshotId $snapshots.Item(0).Id

List Cmdlets

Now we have had a taste of working with the Profitbricks Powershell module. To get more details on every cmdlet contained in Profitbricks Powershell module you can do this:

Get-Command -Module Profitbricks

CommandType     Name                                               Version    Source
-----------     ----                                               -------    ------
Cmdlet          Connect-PBVolume                                   1.0.0.0    ProfitBricks
Cmdlet          Disconnect-PBVolume                                1.0.0.0    ProfitBricks
Cmdlet          Get-PBAttachedVolume                               1.0.0.0    ProfitBricks
Cmdlet          Get-PBBalancedNics                                 1.0.0.0    ProfitBricks
Cmdlet          Get-PBDatacenter                                   1.0.0.0    ProfitBricks
Cmdlet          Get-PBFirewallRule                                 1.0.0.0    ProfitBricks
Cmdlet          Get-PBImage                                        1.0.0.0    ProfitBricks
Cmdlet          Get-PBIPBlock                                      1.0.0.0    ProfitBricks
Cmdlet          Get-PBLan                                          1.0.0.0    ProfitBricks
Cmdlet          Get-PBLoadbalancer                                 1.0.0.0    ProfitBricks
Cmdlet          Get-PBLocation                                     1.0.0.0    ProfitBricks
Cmdlet          Get-PBNic                                          1.0.0.0    ProfitBricks
Cmdlet          Get-PBRequestStatus                                1.0.0.0    ProfitBricks
Cmdlet          Get-PBServer                                       1.0.0.0    ProfitBricks
Cmdlet          Get-PBSnapshot                                     1.0.0.0    ProfitBricks
Cmdlet          Get-PBVolume                                       1.0.0.0    ProfitBricks
Cmdlet          New-PBDatacenter                                   1.0.0.0    ProfitBricks
Cmdlet          New-PBFirewallRule                                 1.0.0.0    ProfitBricks
Cmdlet          New-PBIPBlock                                      1.0.0.0    ProfitBricks
Cmdlet          New-PBLan                                          1.0.0.0    ProfitBricks
Cmdlet          New-PBLoadbalancer                                 1.0.0.0    ProfitBricks
Cmdlet          New-PBNic                                          1.0.0.0    ProfitBricks
Cmdlet          New-PBServer                                       1.0.0.0    ProfitBricks
Cmdlet          New-PBSnapshot                                     1.0.0.0    ProfitBricks
Cmdlet          New-PBVolume                                       1.0.0.0    ProfitBricks
Cmdlet          Remove-PBDatacenter                                1.0.0.0    ProfitBricks
Cmdlet          Remove-PBFirewallRule                              1.0.0.0    ProfitBricks
Cmdlet          Remove-PBIPBlock                                   1.0.0.0    ProfitBricks
Cmdlet          Remove-PBLan                                       1.0.0.0    ProfitBricks
Cmdlet          Remove-PBLoadbalancer                              1.0.0.0    ProfitBricks
Cmdlet          Remove-PBNic                                       1.0.0.0    ProfitBricks
Cmdlet          Remove-PBNicFromLoadbalancer                       1.0.0.0    ProfitBricks
Cmdlet          Remove-PBServer                                    1.0.0.0    ProfitBricks
Cmdlet          Remove-PBSnapshot                                  1.0.0.0    ProfitBricks
Cmdlet          Remove-PBVolume                                    1.0.0.0    ProfitBricks
Cmdlet          Reset-PBServer                                     1.0.0.0    ProfitBricks
Cmdlet          Restore-PBSnapshot                                 1.0.0.0    ProfitBricks
Cmdlet          Set-PBDatacenter                                   1.0.0.0    ProfitBricks
Cmdlet          Set-PBFirewallRule                                 1.0.0.0    ProfitBricks
Cmdlet          Set-PBLan                                          1.0.0.0    ProfitBricks
Cmdlet          Set-PBLoadbalancer                                 1.0.0.0    ProfitBricks
Cmdlet          Set-PBNic                                          1.0.0.0    ProfitBricks
Cmdlet          Set-PBNicToLoadbalancer                            1.0.0.0    ProfitBricks
Cmdlet          Set-PBServer                                       1.0.0.0    ProfitBricks
Cmdlet          Set-PBSnapshot                                     1.0.0.0    ProfitBricks
Cmdlet          Set-PBVolume                                       1.0.0.0    ProfitBricks
Cmdlet          Set-ProfitBricks                                   1.0.0.0    ProfitBricks
Cmdlet          Start-PBServer                                     1.0.0.0    ProfitBricks
Cmdlet          Stop-PBServer                                      1.0.0.0    ProfitBricks

Get Help for a Cmdlet

To get help for a specific cmdlet do the following:

Get-Help Set-Profitbricks -Full

NAME
    Set-Profitbricks

SYNOPSIS
    This is the cmdlet that sets your ProfitBricks credentials.

SYNTAX
    Set-Profitbricks [-Credential] <PSCredential> [<CommonParameters>]


DESCRIPTION


PARAMETERS
    -Credential <PSCredential>
        Required?                    true
        Position?                    0
        Default value
        Accept pipeline input?       true (ByValue)
        Accept wildcard characters?  false

    <CommonParameters>
        This cmdlet supports the common parameters: Verbose, Debug,
        ErrorAction, ErrorVariable, WarningAction, WarningVariable,
        OutBuffer, PipelineVariable, and OutVariable. For more information, see
        about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
    System.Management.Automation.PSCredential




OUTPUTS

----------  EXAMPLE 1  ----------

$credentials = Get-Credential -Message [message text] -UserName [user_name]
Set-Profitbricks -Credential $credential

Reference

This section provides reference information for the cmdlets that are part of the ProfitBricks PowerShell module. Similar usage information can be accessed from inside PowerShell using the Get-Help process described above.

Set-Profitbricks

Used to supply the module with your ProfitBricks authentication credentials.

PS C:\> $PBcreds = Get-Credential -Message ProfitBricks -UserName user@domain.tld

A "Windows PowerShell credential request." window will appear. The value for -Message will show in the window, along with a prompt for User name: pre-populated with the value you supplied for -UserName. You will need to enter your password in the Password: box. Now pass those credentials to Set-Profitbricks:

PS C:\> Set-Profitbricks -Credential $PBcreds

If the credentials are valid, you should be rewarded with:

Authorization successful

These credentials will remain valid until you exit your PowerShell session.

Data Center

Get-PBDatacenter

Running this cmdlet will return a list of all the currently provisioned data centers available to you.

You have the option to include the -DataCenterId parameter and pass it a valid virtual data center ID to get information about a single virtual data center. A virtual data center ID has the format 8-4-4-4-12. An example is: c8b3f40e-8d19-4bb3-8a87-5a09b14ada13

Name Required Type Description
DataCenterId no string The ID of an existing VDC.
PS C:\>Get-PBDataCenter

PS C:\>Get-PBDataCenter -DataCenterId c8b3f40e-8d19-4bb3-8a87-5a09b14ada13

New-PBDatacenter

Use this to create a new virtual data center. The required parameters are -Name and -Location with an option of supplying a -Description.

Name Required Type Description
Name Yes string Desired name for this VDC.
Location Yes string Location of the VDC. Use Get-PBLocation to retrieve valid locations.
Description no string A description of the VDC.
PS C:\>New-PBDataCenter -Name "VDC01" -Location "us/ewr" -Description "VDC 01"

Set-PBDatacenter

Use this to update an existing virtual data center. You cannot change the location of a provisioned virtual data center, so the only valid parameters for this command are passing in a new -Name and/or -Location.

Name Required Type Description
DataCenterId Yes string The ID of an existing VDC.
Name no string Updated name for this VDC.
Description no string Updated description of the VDC.
PS C:\>Set-PBDataCenter -DataCenterId c8b3f40e-8d19-4bb3-8a87-5a09b14ada13 -Name "UpdatedVDC01" -Description "Updated VDC 01"

Remove-PBDatacenter

Removes an entire virtual data center and all the resources it contains.

Name Required Type Description
DataCenterId Yes string The ID of an existing VDC.
PS C:\>Remove-PBDataCenter -DataCenterId c8b3f40e-8d19-4bb3-8a87-5a09b14ada13

Locations

Get-PBLocation

Retrieves a location or a list of locations that virtual data centers may be provisioned in. Simply run it to retrieve the available locations. Pass in the -LocationId parameter with a specific location to get details about that specific location.

Name Required Type Description
LocationId no string The ID of an existing VDC.
PS C:\>Get-PBLocation

PS C:\>Get-PBLocation -LocationId "us/ewr"

Servers

Get-PBServer

Running this cmdlet will return a list of all the currently provisioned servers in a specific virtual data center supplied using the -DataCenterId parameter.

You have the option to include a -ServerId parameter and pass it a server ID to get information about a single server.

Name Required Type Description
DataCenterId Yes string The ID of an existing VDC.
ServerId no string The ID of an existing server.
PS C:\>Get-PBServer -DataCenterId c8b3f40e-8d19-4bb3-8a87-5a09b14ada13

PS C:\>Get-PBServer -DataCenterId c8b3f40e-8d19-4bb3-8a87-5a09b14ada13 -ServerId [A ServerId]

New-PBServer

Creates a new server.

Name Required Type Description
DataCenterId Yes string The ID of an existing VDC.
Name Yes string A name for the server.
Cores Yes int The number of CPU cores.
Ram Yes int The amount of memory in MB. Must be a multiple of 256 with a minimum of 256 MB or 1024 MB if you enable 'ramHotPlug'.
ImageId no string An image or snapshot ID.
PublicIP no bool
StaticIP no bool
CpuFamily no string The CPU family (AMD_OPTERON or INTES_XEON). Default: AMD_OPTERON.
SshKey no string Adds a SSH key for authentication to ProfitBricks Public Linux images.
AvailabilityZone no string The compute availability zone. AUTO, ZONE_1, or ZONE_2.
BootVolume no string The ID of a the boot volume.
BootCDRom no string The ID of a CD-ROM image to boot from.
Size no int Sets the size of the storage volume in GB.
DiskType no string Sets the type of storage volume. HDD on SSD.
Password no string Sets a password for authentication with ProfitBricks Public images.

Set-PBServer

Updates the configuration of an existing server.

Creates a new server.

Name Required Type Description
DataCenterId Yes string The ID of an existing VDC.
ServerId Yes string The ID of the server you want to update.
Name no string A name for the server.
Cores no int The number of CPU cores.
Ram no int The amount of memory in MB. Must be a multiple of 256 with a minimum of 256 MB or 1024 MB if you enable 'ramHotPlug'.
CpuFamily no string The CPU family (AMD_OPTERON or INTES_XEON). Default: AMD_OPTERON.
AvailabilityZone no string The compute availablity zone. AUTO, ZONE_1, or ZONE_2.

Remove-PBServer

Deletes a server.

Name Required Type Description
DataCenterId Yes string The ID of an existing VDC.
ServerId Yes string The ID of the server you want to delete.

Start-PBServer

Starts a server.

Name Required Type Description
DataCenterId Yes string The ID of an existing VDC.
ServerId Yes string The ID of the server you want to update.

Stop-PBServer

Stops a server.

Name Required Type Description
DataCenterId Yes string The ID of an existing VDC.
ServerId Yes string The ID of the server you want to update.

Reset-PBServer

Reboots a server.

Name Required Type Description
DataCenterId Yes string The ID of an existing VDC.
ServerId Yes string The ID of the server you want to update.

Images

Get-PBImage

Gets a list of all available images or detailed properties of a specific image.

Name Required Type Description
ImageId no string The ID of an image.

Volumes

Get-PBVolume

Retrieves information about all volumes in a VDC, or detailed properties of a specific volume.

Name Required Type Description
DataCenterId Yes string The ID of an existing VDC.
VolumeId no string The ID of a volume.

New-PBVolume

Creates a new storage volume.

Name Required Type Description
DataCenterId Yes string The ID of an existing VDC.
Size no int Sets the size of the storage volume in GB.
Type no string Sets the type of storage volume. HDD on SSD.
Bus no string The bus type. Set to either VIRTIO or IDE.
Name no string A name for the server.
ImageId no string An image or snapshot ID.
LicenceType no string WINDOWS2016, WINDOWS, LINUX, OTHER, UNKNOWN.
SshKey no string Adds a SSH key for authentication to ProfitBricks Public Linux images.
AvailabilityZone no string The compute availability zone. AUTO, ZONE_1, ZONE_2, or ZONE_3.
ImagePassword no string Sets a password for authentication with ProfitBricks Public images.

Set-PBVolume

Update the properties of a storage volume.

Name Required Type Description
DataCenterId Yes string The ID of an existing VDC.
VolumeId Yes string The ID of the volume you wish to update.
Size no int Sets the size of the storage volume in GB.
Type no string Sets the type of storage volume. HDD on SSD.
Bus no string The bus type. Set to either VIRTIO or IDE.
Name no string A name for the server.
ImageId no string An image or snapshot ID.
LicenceType no string WINDOWS2016, WINDOWS, LINUX, OTHER, UNKNOWN.
SshKey no string Adds a SSH key for authentication to ProfitBricks Public Linux images.
AvailabilityZone no string The compute availablity zone. AUTO, ZONE_1, ZONE_2, or ZONE_3.
ImagePassword no string Sets a password for authentication with ProfitBricks Public images.
CpuHotPlug no bool The volume is capable of CPU hot plug (no reboot required).
CpuHotUnplug no bool The volume is capable of CPU hot unplug (no reboot required).
RamHotPlug no bool The volume is capable of RAM hot plug (no reboot required).
RamHotUnplug no bool The volume is capable of RAM hot unplug (no reboot required).
NicHotPlug no bool The volume is capable of NIC hot plug (no reboot required).
NicHotUnplug no bool The volume is capable of NIC hot unplug (no reboot required).
DiscVirtioHotPlug no bool The volume is capable of VIRTIO hot plug (no reboot required).
DiscVirtioHotUnplug no bool The volume is capable of VIRTIO hot unplug (no reboot required).
DiscScsiHotPlug no bool The volume is capable of SCSI drive hot plug (no reboot required).
DiscScsiHotUnplug no bool The volume is capable of SCSI drive hot unplug (no reboot required).

Remove-PBVolume

Delete a volume.

Name Required Type Description
DataCenterId Yes string The ID of an existing VDC.
VolumeId Yes string The ID of the volume you wish to delete.

Get-PBAttachedVolume

Retrieve a list of volumes connected to a specific server.

Name Required Type Description
DataCenterId Yes string The ID of an existing VDC.
ServerId Yes string The ID of the server.

Connect-PBVolume

Connect a specific volume to a specific server.

Name Required Type Description
DataCenterId Yes string The ID of an existing VDC.
ServerId Yes string The ID of the server.
VolumeId Yes string The ID of the volume.

Disconnect-PBVolume

Disconnect a specific volume from a specific server.

Name Required Type Description
DataCenterId Yes string The ID of an existing VDC.
ServerId Yes string The ID of the server.
VolumeId Yes string The ID of the volume.

Snapshots

Get-PBSnapshot

Get a list of all snapshots, or details about a specific snapshot.

Name Required Type Description
SnapshotId Yes string The ID of a snapshot.

New-PBSnapshot

Creates a new snapshot.

Name Required Type Description
DataCenterId Yes string The ID of an existing VDC.
VolumeId Yes string The ID of the volume.
Name no string A name for the snapshot.
Description no string A description of the snapshot.

Set-PBSnapshot

Update the properties of a snapshot.

Name Required Type Description
SnapshotId Yes string The ID of a snapshot.
Name no string A name for the snapshot.
Description no string A description of the snapshot.
LicenceType no string WINDOWS2016, WINDOWS, LINUX, OTHER, UNKNOWN.
CpuHotPlug no bool The volume is capable of CPU hot plug (no reboot required).
CpuHotUnplug no bool The volume is capable of CPU hot unplug (no reboot required).
RamHotPlug no bool The volume is capable of RAM hot plug (no reboot required).
RamHotUnplug no bool The volume is capable of RAM hot unplug (no reboot required).
NicHotPlug no bool The volume is capable of NIC hot plug (no reboot required).
NicHotUnplug no bool The volume is capable of NIC hot unplug (no reboot required).
DiscVirtioHotPlug no bool The volume is capable of VIRTIO hot plug (no reboot required).
DiscVirtioHotUnplug no bool The volume is capable of VIRTIO hot unplug (no reboot required).
DiscScsiHotPlug no bool The volume is capable of SCSI drive hot plug (no reboot required).
DiscScsiHotUnplug no bool The volume is capable of SCSI drive hot unplug (no reboot required).

Remove-PBSnapshot

Deletes a snapshot.

Name Required Type Description
SnapshotId Yes string The ID of a snapshot.

Restore-PBSnapshot

Restores a snapshot onto an existing volume.

Name Required Type Description
DataCenterId Yes string The ID of an existing VDC.
VolumeId Yes string The ID of the volume.
SnapshotId Yes string The ID of a snapshot.

IP Blocks

Get-PBIPBlock

Retrieve a list of reserved IP blocks, or details about a specific IP block.

Name Required Type Description
IPBlockId Yes string The ID of an existing IP block.

New-PBIPBlock

Creates a new IP block.

Name Required Type Description
Location Yes string The location of the new IP block. us/las, us/ewr, de/fkb, de/fra
Size Yes int The number of IP addresses to reserve.

Remove-PBIPBlock

Deletes an IP block.

Name Required Type Description
IPBlockId Yes string The ID of an existing IP block.

LANs

Get-PBLan

Retrieves a list of LANs, or details about a specific LAN.

Name Required Type Description
DataCenterId Yes string The ID of an existing VDC.
LanId no string The ID of an existing LAN.

New-PBLan

Create a new LAN.

Name Required Type Description
DataCenterId Yes string The ID of an existing VDC.
Name no string The name of your LAN.
Public no bool Set to TRUE to indicate the LAN is public.

Set-PBLan

Update an existing LAN.

Name Required Type Description
DataCenterId Yes string The ID of an existing VDC.
LanId Yes string The ID of an existing LAN.
Name no string The name of your LAN.
Public no bool Set to TRUE to indicate the LAN is public.

Remove-PBLan

Delete an existing LAN.

Name Required Type Description
DataCenterId Yes string The ID of an existing VDC.
LanId Yes string The ID of an existing LAN.

NICs

Get-PBNic

Retrieve details about all available NICs, or a specific NIC.

Name Required Type Description
DataCenterId Yes string The ID of an existing VDC.
ServerId Yes string The ID of an existing server.
NicId no string The ID of an existing NIC.

New-PBNic

Create a new NIC.

Name Required Type Description
DataCenterId Yes string The ID of an existing VDC.
ServerId Yes string The ID of an existing server.
LanId Yes int The ID for the LAN the NIC is connected to. If it doesn't exist, it will be created.
Name no string A name for the LAN.
Ips no list A list of IP addresses to assign to the NIC.
DHCP no bool Set to FALSE to disable DHCP on the NIC. Default is: TRUE.
FirewallActive no bool
Nat no bool

Set-PBNic

Update an existing NIC.

Name Required Type Description
DataCenterId Yes string The ID of an existing VDC.
ServerId Yes string The ID of an existing server.
NicId Yes int The ID of the NIC.
Name no string A name for the NIC.
Ips no list A list of IP addresses to assign to the NIC.
DHCP no bool Set to FALSE to disable DHCP on the NIC. Default is: TRUE.
LanId no int The ID for the LAN.
Nat no bool

Remove-PBNic

Remove a NIC

Name Required Type Description
DataCenterId Yes string The ID of an existing VDC.
ServerId Yes string The ID of an existing server.
NicId Yes int The ID for the NIC you wish to delete.

Firewall Rules

Get-PBFirewallRule

Returns a list of firewall rules associated with a particular NIC, or details about a specific firewall rule.

Name Required Type Description
DataCenterId Yes string The ID of an existing VDC.
ServerId Yes string The ID of an existing server.
NicId Yes int The ID of the NIC.
FirewallRuleId no string The ID of a firewall rule.

New-PBFirewallRule

Creates a new firewall rule.

Name Required Type Description
DataCenterId Yes string The ID of an existing VDC.
ServerId Yes string The ID of an existing server.
NicId Yes int The ID of the NIC.
Protocol Yes string TCP, UDP, ICMP, ANY.
Name no string The name of the firewall rule.
SourceMac no string Only traffic originating from the respective MAC address is allowed. Valid format: aa:bb:cc:dd:ee:ff. Value "null" allows all source MAC addresses.
SourceIp no string Only traffic originating from the respective IPv4 address is allowed. Value "null" allows all source IPs.
TargetIp no string In case the target NIC has multiple IP addresses, only traffic directed to the IP address of the NIC is allowed. Value "null" allows all target IPs.
PortRangeStart no int Defines the start range of the allowed port (from 1 to 65534) if protocol TCP or UDP is chosen. Leave portRangeStart and portRangeEnd value "null" to allow all ports.
PortRangeEnd no int Defines the start range of the allowed port (from 1 to 65534) if protocol TCP or UDP is chosen. Leave portRangeStar and portRangeEnd value "null" to allow all ports.
IcmpType no int Defines the allowed type (from 0 to 254) if the protocol ICMP is chosen. Value "null" allows all types.
IcmpCode no int Defines the allowed code (from 0 to 254) if the protocol ICMP is chosen. Value "null" allows all types.

Set-PBFirewallRule

Updates an existing firewall rule.

Name Required Type Description
DataCenterId Yes string The ID of an existing VDC.
ServerId Yes string The ID of an existing server.
NicId Yes int The ID of the NIC.
FirewallRuleId Yes string The ID of the firewall rule to update.
Protocol no string TCP, UDP, ICMP, ANY.
Name no string The name of the firewall rule.
SourceMac no string Only traffic originating from the respective MAC address is allowed. Valid format: aa:bb:cc:dd:ee:ff. Value "null" allows all source MAC addresses.
SourceIp no string Only traffic originating from the respective IPv4 address is allowed. Value "null" allows all source IPs.
TargetIp no string In case the target NIC has multiple IP addresses, only traffic directed to the IP address of the NIC is allowed. Value "null" allows all target IPs.
PortRangeStart no int Defines the start range of the allowed port (from 1 to 65534) if protocol TCP or UDP is chosen. Leave portRangeStart and portRangeEnd value "null" to allow all ports.
PortRangeEnd no int Defines the start range of the allowed port (from 1 to 65534) if protocol TCP or UDP is chosen. Leave portRangeStar and portRangeEnd value "null" to allow all ports.
IcmpType no int Defines the allowed type (from 0 to 254) if the protocol ICMP is chosen. Value "null" allows all types.
IcmpCode no int Defines the allowed code (from 0 to 254) if the protocol ICMP is chosen. Value "null" allows all types.

Remove-PBFirewallRule

Deletes the specified firewall rule.

Name Required Type Description
DataCenterId Yes string The ID of an existing VDC.
ServerId Yes string The ID of an existing server.
NicId Yes int The ID of the NIC.
FirewallRuleId Yes string The ID of the firewall rule to delete.

Load Balancers

Get-PBLoadbalancer

Retrieve a list of load balancers in a specific data center, or details about a specific load balancer.

Name Required Type Description
DataCenterId Yes string The ID of an existing VDC.
LoadbalancerId no string The ID of an existing load balancer.

New-PBLoadbalancer

Create a new load balancer.

Name Required Type Description
DataCenterId Yes string The ID of an existing VDC.
Name Yes string A name for the load balancer.
Ip no string IPv4 address of the load balancer. All connected NICs will inherit this IP.
Dhcp no bool Indicates if the load balancer should reserve and IP using DHCP.

Set-PBLoadbalancer

Update a load balancer.

Name Required Type Description
DataCenterId Yes string The ID of an existing VDC.
LoadbalancerId Yes string The ID of the load balancer to update.
Name no string A name for the load balancer.
Ip no string IPv4 address of the load balancer. All connected NICs will inherit this IP.
Dhcp no bool Indicates if the load balancer should reserve and IP using DHCP.

Remove-PBLoadbalancer

Delete a load balancer.

Name Required Type Description
DataCenterId Yes string The ID of an existing VDC.
LoadbalancerId Yes string The ID of the load balancer to delete.

Get-PBBalancedNics

Retrieve a list of NICs associated with the specified load balancer.

Name Required Type Description
DataCenterId Yes string The ID of an existing VDC.
LoadbalancerId Yes string The ID of the load balancer.

Set-PBNicToLoadbalancer

Name Required Type Description
DataCenterId Yes string The ID of an existing VDC.
LoadbalancerId Yes string The ID of the load balancer.
NicId Yes string The ID of the NIC to add to the load balancer.

Remove-PBNicFromLoadbalancer

This will remove the association of a NIC from the specified load balancer.

Name Required Type Description
DataCenterId Yes string The ID of an existing VDC.
LoadbalancerId Yes string The ID of the load balancer.
NicId Yes string The ID of the NIC to remove from the load balancer.

Requests

Get-PBRequestStatus

Used to retrieve the status of an existing request.

Name Required Type Description
RequestUrl Yes string The URL of an existing request.

Support

You are welcome to contact us with questions or comments using the Community section of IONOS DevOps Central. Please report any feature requests or issues using the GitHub issue tracker.