0% found this document useful (0 votes)
2 views

3 Cloud Formation

Cloud Formation is an AWS service that provisions infrastructure using 'Infrastructure as Code' (IAAC) with support for JSON and YML configurations. It allows for the creation and reuse of templates, making infrastructure deployment more efficient and less error-prone compared to manual methods. The document also includes a guide for creating an EC2 instance using a Cloud Formation template, detailing the necessary parameters and resources.

Uploaded by

Raghav Khajuria
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

3 Cloud Formation

Cloud Formation is an AWS service that provisions infrastructure using 'Infrastructure as Code' (IAAC) with support for JSON and YML configurations. It allows for the creation and reuse of templates, making infrastructure deployment more efficient and less error-prone compared to manual methods. The document also includes a guide for creating an EC2 instance using a Cloud Formation template, detailing the necessary parameters and resources.

Uploaded by

Raghav Khajuria
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

=================

Cloud Formation
=================

=> Cloud Formation service is used to provision infrastructure in AWS Cloud.

=> Cloud Formation works based on 'Infrastructure as a code' (IAAC)

=> Cloud Formation supports JSON and YML configurations

Note: If we create infrastructure manually it takes lot of time and it is error


prone.

=> If we design cloud formation template to create Infrasture then we can re-use
that template multiple times.

Note: Cloud Formation service works only in AWS Cloud.

Note: The alternate for 'Cloud Formation' service is 'TERRAFORM' tool.

=> Terraform works with almost all cloud platforms available in the market.

==============================================
Creating EC2 instance using Cloud Formation
==============================================

=> Go to AWS Management Console and Navigate to 'Cloud Formation'

=> Click on Create Stack and upload below Template File

---------------------------- Ec2 - creation - using - yml - file


-------------------------

Description: Ashok IT - Build Linux Web Server


Parameters:
LatestAmiId:
Description: AMI Linux EC2
Type: 'AWS::SSM::Parameter::Value<AWS::EC2::Image::Id>'
Default: '/aws/service/ami-amazon-linux-latest/amzn2-ami-hvm-x86_64-gp2'
Resources:
webserver1:
Type: AWS::EC2::Instance
Properties:
InstanceType: "t2.micro"
ImageId: !Ref LatestAmiId
SecurityGroupIds:
- !Ref WebserverSecurityGroup
Tags:
- Key: Name
Value: webserver1
UserData:
Fn::Base64: !Sub |
#!/bin/bash -xe
yum update -y
yum install httpd -y
service httpd start
chkconfig httpd on
cd /var/www/html
echo "<br>" >> index.html
echo "<h2><b>Ashok IT EC2 Linux Demo</b></h2>" >>index.html
WebserverSecurityGroup:
Type: AWS::EC2::SecurityGroup
Properties:
GroupDescription: Enable Port 80
Tags:
- Key: Name
Value: webserver-sg
SecurityGroupIngress:
- IpProtocol: tcp
FromPort: 80
ToPort: 80
CidrIp: 0.0.0.0/0

------------------------------------------------------------------------

=> Verify EC2 dashboard, we can see EC2 instance created

=> Access EC2 VM public in browser.

=======================================================================

You might also like