-
Notifications
You must be signed in to change notification settings - Fork 3
/
linux-host-stack.yml
88 lines (70 loc) · 1.99 KB
/
linux-host-stack.yml
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
AWSTemplateFormatVersion: 2010-09-09
# subnet should be public.
# aws cloudformation create-stack --stack-name test-ipsec --template-body file://linux-host-stack.yml --parameters ParameterKey=VPC,ParameterValue=vpc-a03301c7 ParameterKey=Subnet,ParameterValue=subnet-2a6f0271 ParameterKey=KeyName,ParameterValue=oreillyd-z420 ParameterKey=Image,ParameterValue=ami-1b791862
# aws cloudformation describe-stacks --stack-name test-ipsec
Description: Create an EC2 instance for StrongSwan
Parameters:
VPC:
Description: VPC for security groups
Type: String
Subnet:
Description: Public subnet in VPC to launch instance
Type: String
KeyName:
Description: EC2 ssh keypair name
Type: String
Image:
Description: EC2 image to launch
Type: String
Resources:
SecurityGroup:
Type: "AWS::EC2::SecurityGroup"
Properties:
GroupDescription: ssh and ipsec
VpcId: !Ref VPC
Tags:
- Key: Name
Value: TestVPN
AllowSsh:
Type: "AWS::EC2::SecurityGroupIngress"
Properties:
IpProtocol: tcp
CidrIp: "0.0.0.0/0"
FromPort: 22
ToPort: 22
GroupId: !Ref SecurityGroup
AllowUDP500:
Type: "AWS::EC2::SecurityGroupIngress"
Properties:
IpProtocol: udp
CidrIp: "0.0.0.0/0"
FromPort: 500
ToPort: 500
GroupId: !Ref SecurityGroup
AllowUDP4500:
Type: "AWS::EC2::SecurityGroupIngress"
Properties:
IpProtocol: udp
CidrIp: "0.0.0.0/0"
FromPort: 4500
ToPort: 4500
GroupId: !Ref SecurityGroup
Instance1:
Type: "AWS::EC2::Instance"
Properties:
ImageId: !Ref Image
# t2.micro is not the best for net perf
InstanceType: t2.micro
KeyName: !Ref KeyName
SecurityGroupIds:
- !Ref SecurityGroup
SubnetId: !Ref Subnet
Tags:
- Key: Name
Value: TestVPN
Outputs:
Instance:
Value: !Ref Instance1
PublicIP:
Description: public ip
Value: !GetAtt Instance1.PublicIp