-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.yml
94 lines (86 loc) · 2.35 KB
/
init.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
88
89
90
91
92
93
94
Parameters:
NameOfservice:
Description: "The name of the service this to be used for ."
InstanceTypeParameter:
Type: String
Default: t2.micro
AllowedValues:
- t2.micro
- m1.small
- m1.large
Description: Enter t2.micro, m1.small, or m1.large. Default is t2.micro.
##keyname:
description: Name of EC2 Login Key
Types: AWS::EC2::Keypair::Keyname
Mappings:
RegionMap:
us-east-1:
"AMI": "ami-0ff8a91507f77f867"
us-west-1:
"AMI": "ami-0bdb828fd58c52235"
eu-west-1:
"AMI": "ami-047bb4163c506cd98"
ap-southeast-1:
"AMI": "ami-08569b978cc4dfa10"
ap-northeast-1:
"AMI": "ami-06cd52961ce9f0d85"
Resources :
MyInstnce:
Type: AWS::EC2::Instance
Metadata:
AWS::CloudFormation::Init:
config:
packages:
yum:
php: []
httpd: []
wget: []
unzip: []
git: []
Commands:
test:
command: " wget https://www.tooplate.com/zip-templates/2132_clean_work.zip && unzip 2132_clean_work.zip && cp -r 2132_clean_work/* /var/www/html/ "
files:
/var/www/html/hello.html:
content: !Sub |
<!DOCTYPE html>
<html>
<body>
<h1> Welcome to Cloudformation.</h1>
<p> This site is deployed by cloud formation </p>
</body>
</html>
Services:
sysvinit:
httpd:
enabled: true
ensureRunning: true
Properties:
InstnceType: !Ref InstanceTypeParmeter
Keyname: !Ref keyName
ImageId: !findInMap
Tags:
- key: "Name"
Value: !Ref NameOfservice
SecurityGroup:
- !Ref VprofileSG
VprofilesG:
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
SecurityGroupEgress:
- IpProtocol: tcp
FromPort: 80
ToPort: 80
CidrIp: 0.0.0.0/0
Outputs:
PrintSomeInfo:
Value: !GetAtt
- MyInstance
- PublicDnsName