> For the complete documentation index, see [llms.txt](https://stakpak.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://stakpak.gitbook.io/docs/tutorial/deploy-your-own-openvpn-server-on-aws.md).

# Deploy your own OpenVPN Server on AWS

## Overview

<figure><img src="/files/nkhBI7Nt5TCJ1rTXbHip" alt=""><figcaption></figcaption></figure>

Most of your AWS resources should be in private subnets for security reasons, but that also means they’re not directly accessible from the internet. To reach them securely, you need a VPN.

In this tutorial, we’ll use OpenVPN on AWS to create a secure, encrypted connection to your private resources so your team can access them safely.

## Problem

* AWS resources in private subnets aren’t accessible from the internet by default.
* Teams often try to solve this by opening ports or using bastion hosts, which increases security risks.
* These workarounds also add complexity to network management and access control.
* A VPN is needed to provide secure and simple access without exposing services publicly.

### Business Impact

Without a VPN, secure remote access is harder, slower, and more risky. A VPN simplifies access and keeps development and operations running securly.

**But what is a VPN?**

A **VPN (Virtual Private Network)** is a secure, encrypted connection that allows you to access a private network over the internet as if you were physically inside it. It’s commonly used to safely reach internal servers, databases, or applications without exposing them to the public.

## How Stakpak Helps?

It lets you selfhost OpenVPN with zero AWS and Open VPN experience you dont need to read docs or google commands

## Step-by-Step Guide

### Prerequisites

1. [Install Stakpak](/docs/get-started/install-stakpak.md)
2. Cloud provider credentials configured
3. Then just ask it to i want to install openvpn on aws so i can access my private resources
4. Here you chose your preferences

<figure><img src="/files/PeoUx7lgAsWC4XbTI6nW" alt=""><figcaption></figcaption></figure>

5. I want to know more about the different architectures, so let's ask about it

<figure><img src="/files/rRLqOwVnmmo1Y9csSpmT" alt=""><figcaption></figcaption></figure>

6. Here I chose&#x20;
   1. Which AWS Region? EU West 1
   2. Do you have a VPC set ups? Yeah, i have a VPC
   3. How many people need VPN Access? Just one person needs access&#x20;
   4. AWS Client VPN or Self Hosted Open VPN or Open VPN from Market Place? Self Hosted Open VPN

<figure><img src="/files/ed9UifRBkRGbYiVTJeQI" alt=""><figcaption></figcaption></figure>

7. I will just tell it to continue with the defaults

<figure><img src="/files/immULoLqyqbkG62ufIsi" alt=""><figcaption></figcaption></figure>

8. Now we can review the commands and press Enter to continue it will be:
   1. Get the VPC details
   2. Get the subnet details
   3. Check the internet gateway
9. Now it will create a security group for open vpn and get the latest Ubuntu version

<figure><img src="/files/TKbw313j8G0wD4i5ro7N" alt=""><figcaption></figcaption></figure>

10. Now it will create the security group rules, SSH key, and launch the ec2 instance

<figure><img src="/files/ey7UJSwI5qR63GNzehjP" alt=""><figcaption></figcaption></figure>

11. Now that we have the EC2 ready, Stakpak will start setting up open VPN

<figure><img src="/files/UOqHzShNOdtgp0kloihW" alt=""><figcaption></figcaption></figure>

12. That's it, now we can use OpenVPN

<figure><img src="/files/1OU8i65KY5SRxxoLK0Fe" alt=""><figcaption></figcaption></figure>

## Extra Resources:

### References

* [Install Stakpak](/docs/get-started/install-stakpak.md)
* [EC2 Documentation](https://docs.aws.amazon.com/ec2/)
* [Open VPN Documentation](https://openvpn.net/as-docs/general.html)
