Skip to content

Commit c44cd08

Browse files
committed
new IAC code
1 parent 5b387a7 commit c44cd08

2 files changed

Lines changed: 48 additions & 0 deletions

File tree

File renamed without changes.

IAC/1-ec2.yaml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
---
2+
Parameters:
3+
SecurityGroupDescription:
4+
Description: Security Group Description
5+
Type: String
6+
7+
Resources:
8+
MyInstance:
9+
Type: AWS::EC2::Instance
10+
Properties:
11+
AvailabilityZone: us-east-1d
12+
ImageId: ami-a4c7edb2
13+
InstanceType: t2.micro
14+
SecurityGroups:
15+
- !Ref SSHSecurityGroup
16+
- !Ref ServerSecurityGroup
17+
18+
# an elastic IP for our instance
19+
MyEIP:
20+
Type: AWS::EC2::EIP
21+
Properties:
22+
InstanceId: !Ref MyInstance
23+
24+
# our EC2 security group
25+
SSHSecurityGroup:
26+
Type: AWS::EC2::SecurityGroup
27+
Properties:
28+
GroupDescription: Enable SSH access via port 22
29+
SecurityGroupIngress:
30+
- CidrIp: 0.0.0.0/0
31+
FromPort: 22
32+
IpProtocol: tcp
33+
ToPort: 22
34+
35+
# our second EC2 security group
36+
ServerSecurityGroup:
37+
Type: AWS::EC2::SecurityGroup
38+
Properties:
39+
GroupDescription: !Ref SecurityGroupDescription
40+
SecurityGroupIngress:
41+
- IpProtocol: tcp
42+
FromPort: 80
43+
ToPort: 80
44+
CidrIp: 0.0.0.0/0
45+
- IpProtocol: tcp
46+
FromPort: 22
47+
ToPort: 22
48+
CidrIp: 192.168.1.1/32

0 commit comments

Comments
 (0)