Todas as coleções
Getting started with BCOS
How to access instances through key pairs in BCOS?
How to access instances through key pairs in BCOS?

Demonstration of applying SSH key pairs to an instance in BCOS.

Luiz Fernando Justino Silva avatar
Escrito por Luiz Fernando Justino Silva
Updated over a week ago

Key pairs

  In the previous post How to associate volumes in different instances in BCOS? we disconnect volumes from one instance to associate it with another. We will now create a key pair for authenticated access and set a password for instance console access.

  In this post, you will need virtual machine access software that supports key pairs, for example, we will use Xshell: https://www.netsarang.com/en/xshell-download/

  In Project / Compute / Key Pairs click in Create Key Pair:

  At the next screen, enter a name for the key and click in Create Key Pair again:

   • Key pair name: prod01.

  Click in Copy Private Key to Clipboard to copy the contents of the key, and then click in Done:

   Open a text editor on the local computer and paste the contents of the previously copied key:

    Save the file with the name of prod.pem:

 In Project / Compute / Instances create one Instance by clicking in Launch Intance, With the following specifications:

Details:

  • Instance Name: VM04.

Source:

  • Select Boot Source: Image.

  • Create New Volume: No.

  • Image Name: Ubuntu-16.04-LTS.

Flavor:

  • Flavor: BC-1-1024-30.

Networks:

  • Network: network-production.

Security Groups:

  • Name of Security Groups: Default, ALLOW ICMP, ALLOW SSH.

 If you do not have these security groups, go to How to create and join security groups in BCOS? and create ICMP and SSH groups.

Key Pairs:

  • Name of Key Pair: prod01.

Configuration:

  • Customization Script:

           #!/bin/bash

           sudo -i

           apt-get update

           apt-get install -y apache2

           echo 'Apache-VM04' > /var/www/html/index.html

  If you have questions about the instance creation process go to How do I create instances in BCOS? to know more.

  In the created machine actions button (VM04) click in Associate Floating IP, add floating IP and click in Associate:

  Perform an SSH Test on Instance (VM04):

   Then click Browse and select User key, then click in Import, select the key if you save earlier and click in Open:

  • File: prod.pem.

 Note that SSH access has been allowed.

 To access the machine console you must enter a password for the operating system root, so even for SSH access, get administrator permissions (if you don't have one), enter the root password change command and add the new password console access twice:

Example:

  • Super User Permissions: sudo -i.

  • Password change command: passwd root.

  • New password repeated twice: binariocloud.

   Go to your instance console and enter the new password:

Example:

  • User: root.

  • Password: binariocloud.

 In the next post, How to allow HTTP access in instances in BCOS?, we will give HTTP access in Instances.

Respondeu à sua pergunta?