-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathopenvpn-master.json
146 lines (146 loc) · 4.55 KB
/
openvpn-master.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "Set up an OpenVPN server",
"Metadata": {},
"Parameters": {
"OpenVpnAmiId": {
"Default": "ami-0abbb3ceae54aa9fa",
"Description": "Provide the AWS Marketplace OpenVPN AMI ID",
"Type": "AWS::EC2::Image::Id"
},
"AdminUserName": {
"Default": "openvpn",
"Description": "OpenVPN Admin User",
"Type": "String"
},
"AdminPassword": {
"Description": "OpenVPN Admin Password",
"Type": "String",
"NoEcho": true,
"MinLength": 8,
"MaxLength": 32
},
"InstanceType": {
"Default": "t2.nano",
"Description": "Instance type",
"Type": "String"
},
"VpnSecurityGroupID": {
"Description": "The VPC default Security GroupID",
"Type": "AWS::EC2::SecurityGroup::Id"
}
},
"Mappings": {},
"Conditions": {},
"Resources": {
"VpnSecurityGroup": {
"Type": "AWS::EC2::SecurityGroup",
"Properties": {
"GroupDescription": "OpenVPN security group created by cloudformation",
"SecurityGroupIngress": [
{
"IpProtocol": "tcp",
"FromPort": 443,
"ToPort": 443,
"CidrIp": "0.0.0.0/0"
},
{
"IpProtocol": "tcp",
"FromPort": 943,
"ToPort": 943,
"CidrIp": "0.0.0.0/0"
},
{
"IpProtocol": "udp",
"FromPort": 1194,
"ToPort": 1194,
"CidrIp": "0.0.0.0/0"
}
]
}
},
"OpenVpnInstance": {
"Type": "AWS::EC2::Instance",
"Properties": {
"ImageId": {
"Ref": "OpenVpnAmiId"
},
"InstanceType": {
"Ref": "InstanceType"
},
"UserData": {
"Fn::Base64": {
"Fn::Join": [
"",
[
"#!/bin/bash -xe\n",
"apt-get update -y\n",
"public_hostname=",
{
"Fn::ImportValue": "EIPAddress"
},
"\n",
"admin_user=",
{
"Ref": "AdminUserName"
},
"\n",
"admin_pw=",
{
"Ref": "AdminPassword"
},
"\n",
"reroute_gw=1\n",
"\n"
]
]
}
},
"SecurityGroupIds": [
{
"Ref": "VpnSecurityGroupID"
}
],
"SecurityGroups": [
{
"Ref": "VpnSecurityGroup"
}
]
}
},
"OpenVpnEipAsso": {
"Type": "AWS::EC2::EIPAssociation",
"Properties": {
"AllocationId": {
"Fn::ImportValue": "EIPAllocationId"
},
"InstanceId": {
"Ref": "OpenVpnInstance"
}
}
}
},
"Outputs": {
"OpenVPNServerAdminURL": {
"Description": "OpenVPN Admin URL",
"Value": {
"Fn::Join": [
"",
[
"https://",
{
"Fn::ImportValue": "EIPAddress"
},
":943/admin"
]
]
}
},
"VpnInstanceId": {
"Description": "ID of VPN Instance",
"Value": {
"Ref": "OpenVpnInstance"
}
}
}
}