-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathec2.yml
58 lines (57 loc) · 1.7 KB
/
ec2.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
Parameters:
InstanceType:
Description: WebServer EC2 instance type
Type: String
Default: t3.small
ImageId:
Description: ami value
Type: String
Default: ami-06d94a781b544c133
Resources:
EC2Instance:
Type: AWS::EC2::Instance
Properties:
ImageId: !Ref 'ImageId'
KeyName: "mumbai"
InstanceType: !Ref 'InstanceType'
SecurityGroups:
- launch-wizard-2
UserData:
Fn::Base64:
!Sub |
#!/bin/bash
yum update -y
yum install -y httpd.x86_64
systemctl start httpd.service
systemctl enable httpd.service
echo ?Hello World from $(hostname -f)? > /var/www/html/index.html
EC2Instance1:
Type: AWS::EC2::Instance
Properties:
ImageId: !Ref 'ImageId'
KeyName: "mumbai"
InstanceType: !Ref 'InstanceType'
SecurityGroups:
- launch-wizard
UserData:
Fn::Base64:
!Sub |
#!/bin/bash
yum update -y
yum install -y httpd.x86_64
systemctl start httpd.service
systemctl enable httpd.service
echo ?Hello World from $(hostname -f)? > /var/www/html/index.html
Outputs:
InstanceId:
Description: InstanceId of the newly created EC2 instance
Value: !Ref 'EC2Instance'
AZ:
Description: Availability Zone of the newly created EC2 instance
Value: !GetAtt [EC2Instance, AvailabilityZone]
PublicDNS:
Description: Public DNSName of the newly created EC2 instance
Value: !GetAtt [EC2Instance, PublicDnsName]
PublicIP:
Description: Public IP address of the newly created EC2 instance
Value: !GetAtt [EC2Instance, PublicIp]