-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwindows-one-node
107 lines (100 loc) · 2.68 KB
/
windows-one-node
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
AWSTemplateFormatVersion: '2010-09-09'
Description: Template to Create an EC2 instance in a VPC
Parameters:
ImageIDWindows:
Type: 'AWS::SSM::Parameter::Value<AWS::EC2::KeyPair::ImageIDWindows>'
Description: YOUR_IMAGE_ID
Default: ImageIDWindows
VpcId:
Type: String
Description: VPC id
Default: vpc-07377e6c
SubnetId:
Type: String
Description: Subnet in which to launch an EC2
Default: subnet-06377e6d
AvailabilityZone:
Type: String
Description: Availability Zone into which instance will launch
Default: us-west-2a
InstanceType:
Type: String
Description: Instance type
Default: i3.4xlarge
KeyName:
Type: AWS::EC2::KeyPair::KeyName
Description: SSH Keypair to login to the instance
Default: mmalgeri777-keypair-mdb
MyIp:
Type: 'AWS::SSM::Parameter::Value<AWS::EC2::KeyPair::MyIp>'
Description: MY_IP
Default: MyIp
DemoIpRange:
Type: String
Description: Demo Ip Range
Default: 172.31.32.0/20
windowsIp1:
Type: String
Description: Demo Ip 1
Default: 172.31.42.97
Resources:
windows1:
Type: 'AWS::EC2::Instance'
Properties:
ImageId: !Ref ImageIDWindows
InstanceType: !Ref InstanceType
AvailabilityZone: !Ref AvailabilityZone
KeyName: !Ref KeyName
NetworkInterfaces:
- DeviceIndex: 0
PrivateIpAddress: !Ref windowsIp1
DeleteOnTermination: true
SubnetId: !Ref SubnetId
GroupSet:
- !Ref DemoSecurityGroup
- !Ref DemoHttpSecurityGroup
Tags:
- Key: Name
Value: windows1
DemoSecurityGroup:
Type: 'AWS::EC2::SecurityGroup'
Properties:
VpcId: !Ref VpcId
GroupDescription: SG to allow SSH access via port 22
SecurityGroupIngress:
- IpProtocol: tcp
FromPort: '22'
ToPort: '22'
CidrIp: !Ref MyIp
- IpProtocol: tcp
FromPort: '22'
ToPort: '22'
CidrIp: !Ref DemoIpRange
- IpProtocol: tcp
FromPort: '3306'
ToPort: '3306'
CidrIp: !Ref DemoIpRange
- IpProtocol: tcp
FromPort: '3389'
ToPort: '3389'
CidrIp: !Ref MyIp
Tags:
- Key: Name
Value: SSH-SG
DemoHttpSecurityGroup:
Type: 'AWS::EC2::SecurityGroup'
Properties:
VpcId: !Ref VpcId
GroupDescription: SG to allow HTTP access via port 80
SecurityGroupIngress:
- IpProtocol: tcp
FromPort: '80'
ToPort: '80'
CidrIp: !Ref MyIp
Tags:
- Key: Name
Value: SSH-HTTPD
Outputs:
DemoInstanceId:
Description: Instance Id
Value: !Ref windows1