AWS Amazon EC2 VPN Gateway

This page shows how to write Terraform and CloudFormation for Amazon EC2 VPN Gateway and write them securely.


Fix issues in your cloud & app configurations

Test for misconfigurations of this resource in your cloud.


Terraform Example (aws_vpn_gateway)

Provides a resource to create a VPC VPN Gateway.


Example Usage (from GitHub)

resource "aws_vpn_gateway" "west" {
  count = var.vpn_enabled

  tags = {
    Name = "west_vpn_gateway"
resource "aws_vpn_gateway" "vpn_gw" {
  vpc_id =

  tags = map(
  "Name", "eks aws vpn gateway"

CloudFormation Example (AWS::EC2::VPNGateway)

Specifies a virtual private gateway. A virtual private gateway is the endpoint on the VPC side of your VPN connection. You can create a virtual private gateway before creating the VPC itself.

For more information, see AWS Site-to-Site VPN in the AWS Site-to-Site VPN User Guide.


Frequently asked questions

What is AWS Amazon EC2 VPN Gateway?

AWS Amazon EC2 VPN Gateway is a resource for Amazon EC2 of Amazon Web Service. Settings can be wrote in Terraform and CloudFormation.

Where can I find the example code for the AWS Amazon EC2 VPN Gateway?

For Terraform, the heldersepu/hs-scripts and mfamador/terraform-aws-eks-cluster source code examples are useful. See the Terraform Example section for further details.