Use Virtual Machine instead AWS for server development

HI all. Do you maybe want to develop some server for MqTT, or maybe a server with some database on it? Do you have to deploy that server on AWS or Linode? And what is the best way to develop a server-side application? Maybe the answer is to use Virtual Machine instead AWS for server development. In this way, you can simulate work on the remote server without any cost or using AWS Free Tier time for development.

Start, create Server

In beginning, we need two prerequisites. Those are:

Check out my YouTube video on how to install Ubuntu Server in VirtualBox. Also, if you are new to Virtualization and Virtual machine check out my Udemy course Virtualization with VirtualBox or check out my other posts at:

And now we have our Virtual Server. Also, we need to configure the network interface for our Virtual Machine. By default, our network interface for Virtual Machine is configured in NAT adapter mode. In short, this means that we have an internet connection inside our Virtual Machine, but we can not target our Virtual Machine from other PCs. So, this option is not good for server applications and we need to change Attached to for NAT to Bridge Adapter. In this way, our Virtual Machine is visible like one more PC in our local network and that is what we need.

Steps are next:

Connect to Server

Now I want to simulate workflow with the remote server. That means that I want to switch from controlling the server directly on VirtualBox and transfer files over Shared Folder to use ssh connection and use FileZilla to transfer files.

FileZilla

Install FileZilla client for https://filezilla-project.org/. In order to connect to your VM server, you need to know the next info:

  • Your new changed IP address (shown in image above). Use command ip addr
  • User name and password

And now we simply need to fill next fields:

  • Host: <your_IP_address>
  • Username: <your_username>
  • Password: <your_password>
  • Port: 22
  • Press Quick connect
FileZilla connction to VM

SSH connection

Download Putty program from https://www.putty.org/

Now enter in Host Name(or IP address) filed <your_username>@<your_IP_address>, enter Port number 22, and make sure that connection type is SSH.

Putty Settings
SSH connection to VM

Configure Static IP

One more thing, we don’t want our IP address to change over time, with is very possible when working with DHCP (automatic IP Address). Because of that, we want to set the static IP address for our VM server. Check out the YouTube video below in order to configure a static IP address in your VM.

Basically, we need to edit one file /etc/netplan/00-installer-config.yaml with next command.

sudo nano /etc/netplan/00-installer-config.yaml

And we need to comment out the DHCP line and add static IP config.

# This is the network config written by 'subiquity'
network: ethernets:
 enp0s3:
  # dhcp4: true
  addresses: [192.168.0.200/24]
  gateway4: 192.168.0.1
  nameservers:
   addresses: [8.8.8.8, 8.8.4.4]
  version: 2

Now just simply save the file and run the next command to apply changes:

sudo netplan apply

Final Words

And that is all. Now you have a connection to our VM Server with SSH and FileZilla for file transfer, two connections that we would establish if we would use AWS or Linode. With this, we can simulate remote server, develop our server-side application, determine how many CPU cores and RAM our application needs, and there deploy to the cloud.

Do you think that use Virtual Machine instead of AWS for server development is a valid choice? Do you have some other solution? See you in the next post.

Leave a Comment