Coder Social home page Coder Social logo

zcemycl / amazon-openvpn-ddns-terraform Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 33 KB

AWS Deployment of OpenVPN Server with Terraform and Domain Name to Dynamic IP

License: MIT License

HCL 70.33% Shell 29.67%
aws ddns dynamic-dns ec2 openvpn route53 terraform bash boto3 certbot python crontab sacli github-actions

amazon-openvpn-ddns-terraform's Introduction

amazon-openvpn-ddns

  • Provide an alternative to set up OpenVPN Server in EC2.
  • Enable Dynamic Domain Name mapping to changing Elastic IP due to stopped instance.
  • See example here.

Input Variables

Variable name Description Default
AWS_REGION AWS Service Region to deploy eu-west-2
prefix Project Name
vpc_id VPC ID
openvpn_server_ami Any Ubuntu AMI (tested in eu-west-2 ubuntu 22.04 amd64)
subnet_id Subnet ID that OpenVPN server will be deployed to
instance_type OpenVPN Server Instance type t2.small
admin_pwd Admin Password for OpenVPN Server
email Email to register ssl certificate for your subdomain.domain
subdomain Subdomain, like prefix of api.google.com, it is api
domain Domain, like google.com
public_key_openssh Generate your ssh key and put public key here

How to Launch?

  1. Run terraform to deploy.
    terraform init
    terraform apply -auto-approve
  2. Change your hostname when you have access to subdomain.domain/admin.
    • Configuration -> Network Settings -> Hostname or IP Address -> Enter your subdomain.domain.
  3. Check VPN Settings.
    • EC2 should have a private ip address, like 10.1.2.214.
    • VPC cidr is 10.1.0.0/16.
    • Change Network Address to 10.1.16.0.
    • Group Default IP Address Network (Optional) to 10.1.16.0/20.
    • Have clients use specific DNS Servers -- YES : Primary 10.1.0.2
    • YES using NAT.
    • VERY IMPORTANT -- Specify the private subnets to which all clients should be given access (one per line).
sequenceDiagram
  client->>route53: xxx.xxx.xxx vpn access
  route53->>client: public ip address
  box Aqua AWS
  participant openvpn access server(ec2)
  participant private subnet resources
  end
  client->>openvpn access server(ec2): ssh/vpn
  openvpn access server(ec2)->private subnet resources: 
  Note over openvpn access server(ec2),private subnet resources: Access
  loop Every day, Reboot
    openvpn access server(ec2)-->route53: Update IP
  end
Loading

amazon-openvpn-ddns-terraform's People

Contributors

zcemycl avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.