-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCLOUD_FORMATION3.YML
More file actions
89 lines (79 loc) · 2.14 KB
/
CLOUD_FORMATION3.YML
File metadata and controls
89 lines (79 loc) · 2.14 KB
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
Resources:
myVPC:
Type: AWS::EC2::VPC
Properties:
CidrBlock: 10.0.0.0/16
EnableDnsSupport: true
EnableDnsHostnames: true
Tags:
- Key: mustafa
Value: production
mySubnet:
Type: AWS::EC2::Subnet
Properties:
AvailabilityZone: us-west-2a
CidrBlock: 10.0.1.0/24
MapPublicIpOnLaunch: true
Tags:
- Key: mustafa
Value: productionsubnet
VpcId: !Ref myVPC
myInternetGateway:
Type: AWS::EC2::InternetGateway
Properties:
Tags:
- Key: mustafa
Value: productioninternetgateway
GatewayToInternet:
Type: AWS::EC2::VPCGatewayAttachment
Properties:
VpcId: !Ref myVPC
InternetGatewayId: !Ref myInternetGateway
myRoute:
Type: AWS::EC2::Route
DependsOn: GatewayToInternet
Properties:
RouteTableId:
Ref: myRouteTable
DestinationCidrBlock: 0.0.0.0/0
GatewayId: !Ref myInternetGateway
myRouteTable:
Type: AWS::EC2::RouteTable
Properties:
VpcId: !Ref myVPC
Tags:
- Key: mustafa
Value: productionmyroutetable
mySubnetRouteTableAssociation:
Type: AWS::EC2::SubnetRouteTableAssociation
Properties:
SubnetId: !Ref mySubnet
RouteTableId: !Ref myRouteTable
Ec2Instance:
Type: AWS::EC2::Instance
Properties:
ImageId: ami-08e2d37b6a0129927
InstanceType: t2.micro
AvailabilityZone: us-west-2a
NetworkInterfaces:
- AssociatePublicIpAddress: "true"
DeviceIndex: "0"
GroupSet:
- !Ref "InstanceSecurityGroup"
SubnetId: !Ref "mySubnet"
UserData:
Fn::Base64: !Sub |
#!/bin/bash
yum -y install httpd -y
service httpd start
echo "<html><body><h1>WELCOME TO APACHE</h1></body></html>" > /var/www/html/index.html
InstanceSecurityGroup:
Type: AWS::EC2::SecurityGroup
Properties:
GroupDescription: Allow http to client host
VpcId: !Ref myVPC
SecurityGroupIngress:
- IpProtocol: tcp
FromPort: '80'
ToPort: '80'
CidrIp: 0.0.0.0/0