October 14, 2020 By Frederic Lavigne 3 min read

Virtual Private Cloud (VPC) comes with an additional layer of security because your workload can be completely hidden from the public Internet.

There are times, however, when you will want to get into this private network. A common practice is to use a bastion host to jump into your VPC from your local machine, for example. Another option is to install a VPN software inside your VPC to extend the secure VPC network to your local network.

OpenVPN is a popular VPN software solution that can be easily installed on a server, providing a simple way to reach all the servers in your VPC from your local machine.

Source code and instructions on how to deploy a fully functional example of this architecture can be found in GitHub. In this post, I will provide a high-level description of the steps.

Step 1: Deploy the infrastructure with Terraform

We use Terraform to create all the resources depicted above. We provision a VPC, a subnet, and one virtual server instance (the instance is not reachable from the public Internet). Then, we add the bastion. It is another virtual server instance, but it is accessible from the public Internet through a floating IP address. Finally we install OpenVPN on the bastion and connect to our VPN using OpenVPN client.

The set of Terraform files is built around four submodules:

  • vpc: Creates a VPC, a subnet, and rules in the default security group.
  • instance: Creates one (or more) instances in the specified VPC, distributing instances in the subnets.
  • bastion: Creates one host in a specific subnet.
  • ansible: Generates Ansible configuration files.

Step 2: Install software with Ansible

The second step — once the infrastructure is deployed — is to use Ansible to install OpenVPN. With Terraform, we generated the Ansible inventory together with the playbook to install OpenVPN on the bastion host. The rest is about running the right Ansible commands. After running the OpenVPN playbook, we find OpenVPN installed on the bastion and a generated client certificate to connect to the VPN.

Step 3: Connect with the OpenVPN client

Once OpenVPN Connect client is installed, point it to the OpenVPN configuration file generated under the ansible/client-config directory and connect to the VPN. The VPN will push the IBM Cloud private DNS configuration to your local machine, together with the right routes to access all VSIs within the VPC and the cloud service endpoints.

From there, you can connect to virtual server instances and to cloud service endpoints that are usually accessible only from within the IBM Cloud network directly from your local machine.

Feedback, questions, and suggestions

Go ahead and try the sample on your own from the GitHub source. Although the project creates its own VPC, it can be used as a starting point to deploy OpenVPN in your existing VPCs.

If you have feedback, suggestions, or questions about this post, please reach out to me on Twitter (@L2FProd).

Was this article helpful?
YesNo

More from Cloud

How a US bank modernized its mainframe applications with IBM Consulting and Microsoft Azure

9 min read - As organizations strive to stay ahead of the curve in today's fast-paced digital landscape, mainframe application modernization has emerged as a critical component of any digital transformation strategy. In this blog, we'll discuss the example of a US bank which embarked on a journey to modernize its mainframe applications. This strategic project has helped it to transform into a more modern, flexible and agile business. In looking at the ways in which it approached the problem, you’ll gain insights into…

The power of the mainframe and cloud-native applications 

4 min read - Mainframe modernization refers to the process of transforming legacy mainframe systems, applications and infrastructure to align with modern technology and business standards. This process unlocks the power of mainframe systems, enabling organizations to use their existing investments in mainframe technology and capitalize on the benefits of modernization. By modernizing mainframe systems, organizations can improve agility, increase efficiency, reduce costs, and enhance customer experience.  Mainframe modernization empowers organizations to harness the latest technologies and tools, such as cloud computing, artificial intelligence,…

Modernize your mainframe applications with Azure

4 min read - Mainframes continue to play a vital role in many businesses' core operations. According to new research from IBM's Institute for Business Value, a significant 7 out of 10 IT executives believe that mainframe-based applications are crucial to their business and technology strategies. However, the rapid pace of digital transformation is forcing companies to modernize across their IT landscape, and as the pace of innovation continuously accelerates, organizations must react and adapt to these changes or risk being left behind. Mainframe…

IBM Newsletters

Get our newsletters and topic updates that deliver the latest thought leadership and insights on emerging trends.
Subscribe now More newsletters