Deploy VPN servers on any AWS region, get openvpn access using a single command, auto config ec2 instance and download the config file.
# put your ec2 key pair (.pem) in the project root
terraform init && terraform apply --auto-approve
Wait for the execution to finish, the client.ovpn
will be downloaded to the project root soon.
- Terraform
- AWS account
- AWS EC2 key pair
-
Configure variables for custom use
Variable Description Default Required app_name application name openvpn-on-ec2 no region AWS region to deploy the resources us-west-1 no instance_type EC2 instance type t4g.small no ec2_key_name EC2 key pair name - yes ec2_ami_id Map of AMI IDs for each region see variable.tf
no The variable can be configured in the
tfvars
files -
Initialise terraform
terraform init
-
Put your ec2 key pair (.pem) in the project root, otherwise the vpn config can't be downloaded
-
Deploy resources
terraform plan -o plan.out
and
terraform apply plan.out
- VPC
- Public Subnet
- Security Group
- EC2
terraform destroy