-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkittens-cfn.yaml
59 lines (56 loc) · 1.8 KB
/
kittens-cfn.yaml
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
AWSTemplateFormatVersion: 2010-09-09
Description: |
This CloudFormation Template was written for
running Kittens Carousel Static Website on EC2.
Kittens Carousel Static Website will be
deployed on Amazon Linux 2
(ami-00b8917ae86a424c9) EC2 Instance with
custom security group which allows http
connections on port 80 and ssh port 22 from
anywhere. Kittens Carousel Static Website
is downloaded from my Public Github repository,
then deployed on Apache Web Server.
Resources:
WebServerSecurityGroup:
Type: AWS::EC2::SecurityGroup
Properties:
GroupDescription: Enable HTTP for Apache Web Server and SSH for secure connection. # Required
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
WebServerHost:
Type: AWS::EC2::Instance
Properties:
ImageId: ami-00b8917ae86a424c9
InstanceType: t2.micro
KeyName: #ENTER KEY PAIR XXXX
SecurityGroupIds:
- !Ref WebServerSecurityGroup
Tags:
- Key: Name
Value: !Sub Web Server of ${AWS::StackName}
UserData:
Fn::Base64:
!Sub |
#!/bin/bash
yum update -y
yum install httpd -y
FOLDER="https://raw.githubusercontent.com/anilkaynar/Project-101-kittens-carousel-static-website-ec2/main/static-web"
cd /var/www/html
wget $FOLDER/index.html
wget $FOLDER/cat0.jpg
wget $FOLDER/cat1.jpg
wget $FOLDER/cat2.jpg
systemctl start httpd
systemctl enable httpd
Outputs:
WebSiteURL:
Value: !Sub
- http://${PublicAdress}
- PublicAdress: !GetAtt WebServerHost.PublicDnsName