Use cases

Scheduled starting and stopping of the instance

Starting and stopping of the instance can be managed using the following instruction:

  1. Install c2-ec2 utility on Windows or Linux machine to be used for management. This can be either a cloud-based VM or any other computer with Internet access. Installation process is described in CROC Cloud API Client paragraph.

  2. Download API settings Open CROC Cloud management console at, click Settings link in the top right corner, and then click Download API settings

  3. Change one line in these settings: export C2_PROJECT="your project ID here". Put your project ID in the quotation marks. You can view it on the cloud management console at

  4. You will need to export API access settings to the machine, which will start and stop the instance.

  5. Use the following commands (also performed on the machine used to start/stop the instance) to start/stop the instance:

    c2-ec2 StartInstances InstanceId.1 <instance_id> InstanceId.2 <instance_id>
    c2-ec2 StopInstances InstanceId.1 <instance_id> InstanceId.2 <instance_id>
  6. The schedule is set using a task planner (such as crond in Linux).

See more detailed description of using c2-ec2 utility here: Supported API

Adding public SSH key in Linux

Follow the instruction below to add public key in Linux distribution:

  1. Determine a file, in which public keys are stored in the system by executing the following command:

    $ cat /etc/ssh/sshd_config | grep -i authorizedkeysfile
    AuthorizedKeysFile .ssh/authorized_keys
  2. In home directory, create a subdirectory with a file in it if they do not exist (from command output at clause 1 - this is .ssh directory where the authorized_keys file is stored).


    The .ssh directory and authorized_keys file should belong to user who will log in to the system (if the directory is created by a superuser then root will be its owner). To change the directory owner, use sudo chown -R ec2-user command:ec2-user /home/<username>/.ssh/

  3. Use a text editor (vim, nano, etc.) to add public key content to the authorized_keys file (if another public key is already stored there, do not delete it; instead, add new one to the file. This will let you use two different private keys to log in to the system using ssh). An example of public key is shown below:



    Public key shall be a continuous text without any spaces or line breaks.

  4. After a new public key is added, you have to restart sshd:

  • For systems running SysVinit (CentOS 6):

    sudo /etc/init.d/sshd restart
  • For systems running Systemd (CentOS 7):

    sudo systemctl restart sshd

Correcting the resetting time error in Windows

To solve the time problem, you have to edit Windows registry so that it accepts time from BIOS as UTC:

  1. Open Windows registry (Win+R -> regedit -> Enter)

  2. Open HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation

  3. Create new DWORD, name it RealTimeIsUniversal, and set value to 1

  4. Reboot your instance

Advanced file storage management features

The s3cmd utility provides advanced features. Follow the steps below to install and set it up in CentOS 6.

  1. Before installation, you have to obtain the API access settings on Cloud management console: Click Settings, then click “Download API settings”.

  2. Installation:

    # cd /etc/yum.repos.d
    # wget
    # yum -y install s3cmd
  3. Then you have to configure s3cmd (secret and secret key can be obtained from API access settings):

    # s3cmd --configure
    Enter new values or accept defaults in brackets with Enter.
    Refer to user manual for detailed description of all options.
    Access key and Secret key are your identifiers for Amazon S3. Leave them empty for using the env variables.
    Access Key: <имя проекта в облаке КРОК>:<Учётная запись в облаке КРОК>
    Default Region [US]:
    Encryption password is used to protect your files from reading by unauthorized persons while in transfer to S3
    Encryption password:
    Path to GPG program [/usr/bin/gpg]:
    When using secure HTTPS protocol all communication with Amazon S3 servers is protected from 3rd party eavesdropping. This method is slower than plain HTTP, and can only be proxied with Python 2.7 or newer
    Use HTTPS protocol [No]: yes
    New settings:
    Access Key: <имя проекта в облаке КРОК>:<Учётная запись в облаке КРОК>
    Default Region: US
    Encryption password:
    Path to GPG program: /usr/bin/gpg
    Use HTTPS protocol: True
    HTTP Proxy server name:
    HTTP Proxy server port: 0
    Test access with supplied credentials? [Y/n] y
    Save settings? [y/N] y
  4. Then edit /root/.s3cfg configuration file:

    host_base =
    host_bucket = %(bucket)
    signature_v2 = True

Now you can use s3cmd utility. Enter s3cmd –help command to learn how to use the utility

Allocating multiple Public IP addresses to single instance

Follow the below instructions to associate several Public IP addresses with single instance:

  1. Select the subnet where the instance exists.

  2. Select Private addresses tab.

  3. Click Allocate address.

  4. In a window that opens, select your desired options. Select Particular address, fill in the Address field and confirm the address by clicking Allocate address


    The address should be Allocated in the same subnet where the instance exists. If you attempt to Allocate address, which is already Allocated to instance or belongs to other subnet, then error message will appear. The addresses ending with 1 or 255 cannot be Allocated either.

  5. Open Address section, select shared Public address, and click Allocate address.

  6. In a window that opens, select Allocate to Private Address option, enter Private address Allocated at step 4, and click Allocate address.

  7. Then allocate this Private address as the second address of the interface in the operating system. An example below shows how to do this in Windows:

  1. Start -> Control Panel -> Network and Internet -> Network and Sharing Center -> Change Adapter Settings.

  2. Select Local network connection, right-click it and select Properties.

  3. Select Internet Protocol version 4 (TCP/IPv4) and click Properties

  4. In a window that opens, select Use the Following IP Address and click More…

  5. In a window that opens, enter private address, which was Allocated by cloud DHCP server when creating the Instance, and the new one, which was Allocated at step 4. To view the current local address, use the following command: ipconfig (WIN+R->cmd->ipconfig) or open CROC Cloud management console by clicking the instance ID.


    When Allocating addresses manually, please note that mask and a gateway with the last octet of the address with a value of 1 are used. For example, address will have as default gateway. Configuration example is shown below:


Now the instance will be shared at the additional Public IP address.

Adding SSH public key in Putty

Putty uses its own format for keys (.ppk). To use a third-party private key in Putty, you have to convert it to puttygen first:

  1. Open PuTTY Key Generator application and select Conversions-> Import key

  2. In a window that opens, select private key (usually it is in OpenSSH format and has the name .private)

  3. After selecting, the window will be filled with the data from the key.

  4. In this window you can leave a comment in the Key Comment line. In addition, you need to add a password to the private key in Key Passphrase and Confirm Passphrase lines.

  5. Click Save Private Key to save the private key in the format acceptable by PuTTY.

If the same public key is used on multiple severs then you do not need to store private key on each server in order to attach to another server. You can use Pagent (PuTTY authentication agent) for this purpose. To add a key to Pagent:

  1. Run pagent.exe. After startup, the program icon will appear in the system tray.

  2. Double-click the icon in the system tray to manage keys.

  3. In a window that opens, click Add Key and select private key in .ppk format. If the key has a password, enter it in the dialog when adding the key.

Alternatively, you can use the following feature to add a private key to Pagent easier:

  1. Create a shortcut for Pagent software
  2. Right-click the shortcut and select Properties
  3. In the Target field add space and add complete path to the private key in .ppk format

When you open this shortcut next time, private key will be automatically added to Pagent.

To use Pagent in PuTTY:

  1. Run putty.exe
  2. Select Attachment->SSH->Auth
  1. Check Allow Agent Forwarding box on this tab
  2. Open Session tab, select Default Settings, and click Save

Now, when a new attachment is created, its settings will include the use of Pageant for key transmission. The use of Pagent can be avoided if you select Browse instead of Allow Agent Forwarding on step 3 and select a private key to be used for attaching to the instance via ssh.

Instance migration to CROC Cloud

CROC Cloud Platform uses KVM hypervisor. So, before migration, please make sure that virtio drivers are installed and operating system supports using virtio controller. You can start the instance in CROC Cloud even if drivers are not installed, however, when using Volumes and network, the instance will show lower performance than with drivers installed.

  1. If operating system supports virtio controller then install virtio driver to use Volumes and network.

  2. Download Volumes from your virtualization platform

  3. Convert Snapshots to qcow2 format using qemu-img utility. Below is a sample command for conversion from vmdk format:

    qemu-img convert -f vmdk -O qcow2 -p <image_name>.vmdk <image_name>.qcow2
  4. Upload Snapshots to CROC Cloud file storage. Steps to take:

    1. Open CROC Cloud management console at
    2. Open File Storage tab
    3. If you do not have a storage, click Create Storage, allocate a name, and confirm the creation
    4. Select a storage
    5. Click Upload File
    6. Repeat the upload procedure for all Volumes
  5. Select the uploaded Snapshots one by one

  6. Click Create Snapshot

  7. When all Snapshots are created, open Console tab

  8. Open Templates section

  9. Click Create Template

  10. In a window that opens, click Add Volume to add Volumes for the template

  11. Add Snapshots created at step 6, one by one

  12. Position your Volumes so that the root device is the first in the list

  13. If your instance does not have virtio drivers, check Revoke Optimization box

  14. Enter template description and click Create Template

  15. Now you can deploy the instance from this template.

Instruction for creating Windows Server 2012 R2 DC virtual machine

To create a Windows Server 2012 R2 Datacenter virtual machine:

  1. Log in to CROC Cloud console at

  2. To create instances, at least one virtual network should be created. To create it, click Create Network, set network’s IP address in CIDR notation, and confirm the network creation. If a virtual network is already created, then proceed to the next step.

  3. Open Instances tab.

  4. Click New Instance. In a window that opens, select win2k12R2DC and click Next.

  5. Select the desired Instance Type. For Windows, selecting an instance type with at least 2 GB RAM is recommended. You can also set additional options: Virtualization Type, Placement Group, Cluster, Allocate Public address, High Availability, Terminate on instance stopped, and Monitoring. Then click Start New Instance.

  6. Then click ID of the instance. In a window that opens, click Remote Console.

  7. Select the desired options and click Next.

  8. Read the license agreement and click I accept.

  9. Enter the administrator password, which will be used for logging in to the system. Then click Finish

  10. To log in to the system, press Ctrl+Alt+Delete. This key combination can be transferred to the operating system by clicking a marked button in the top right corner of CROC Cloud remote console.

  11. To log in to the system, enter the password, which was set at previous step, and press Enter.

  12. Windows Server 2012 R2 Datacenter virtual machine is now created.

  13. To access virtual machines using RDP, you need to set up the rule in the security group. Open your security group, click Ingress rules, and then click Add rule. In a window that opens, set protocol to tcp. Then specify set address range (CIDR notation is used: to add a single host, set ip_address/32, to add a subnet, use a smaller mask) and set port to 3389, and click Add rule.