-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtemplate2.yml
42 lines (42 loc) · 1.1 KB
/
template2.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
AWSTemplateFormatVersion: 2010-09-09
Resources:
WebServerSecurityGroup:
Type: 'AWS::EC2::SecurityGroup'
Properties:
GroupDescription: >-
Enable HTTP access via port 80 locked down to the load balancer + SSH
access
SecurityGroupIngress:
- IpProtocol: tcp
FromPort: '80'
ToPort: '80'
CidrIp: 0.0.0.0/0
- IpProtocol: tcp
FromPort: '22'
ToPort: '22'
CidrIp: 0.0.0.0/0
WebServer:
Type: 'AWS::EC2::Instance'
Properties:
ImageId: ami-02fd0b06f06d93dfc
InstanceType: t2.micro
SecurityGroups:
- !Ref WebServerSecurityGroup
KeyName: myec22
UserData: !Base64
'Fn::Sub': |-
#!/bin/bash -xe
yum update -y
yum install -y httpd
service httpd start
echo "<html><h1>Hello from CloudFormation!</h1></html>" > /var/www/html/test.html
Outputs:
WebsiteURL:
Value: !Join
- ''
- - 'http://'
- !GetAtt
- WebServer
- PublicDnsName
- /test.html
Description: test Website