Cloud-Formation Template for N-tier(JSON)

https://drive.google.com/open?id=14EyRo2opvvDfxGVJTRfeJEDZxLKc8LjU

Create a Template for the following:

 
* Region => Mumbai
  * CIDR  => 192.168.0.0/16
  * Subnets => 2 Subnets
    * Web:
        CIDR  => 192.168.0.0/24
    * Data:
        CIDR  => 192.168.1.0/24
  * Internet Gateway
  * Route Table => Should allow all incoming & outgoing traffic
  * 2 Virtual Machines (EC2 Instances in each subnet)

Steps:
  1.  Create a VPC
  2.  Create a two subnets
  3. Create a internet gateway
  4. Attach it to your vpc
  5. create a route table
  6. In the routetable create a route destination : 0.0.0.0/0 target : igw
  7. Associate your subnets to route table
=======================================================
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "Network vpc with subnet",
"Resources": {
"myVpc": {
"Description": "MYVPC details",
"Type": "AWS::EC2::VPC",
"Properties": {
"CidrBlock": "192.168.0.0/16",
"Tags": [
{
"Key": "Name",
"Value": "ntier-VPC"
}
]
}
},
"webSubnet": {
"Description": "MY WEB SUBNET details",
"Type": "AWS::EC2::Subnet",
"Properties": {
"AvailabilityZone": "ap-south-1a",
"CidrBlock": "192.168.0.0/24",
"VpcId": {
"Ref": "myVpc"
},
"Tags": [
{
"Key": "Name",
"Value": "web-subnet"
}
]
}
},
"dataSubnet": {
"Description": "MY DATA SUBNET details",
"Type": "AWS::EC2::Subnet",
"Properties": {
"AvailabilityZone": "ap-south-1b",
"CidrBlock": "192.168.1.0/24",
"VpcId": {
"Ref": "myVpc"
},
"Tags": [
{
"Key": "Name",
"Value": "date-subnet"
}
]
}
},
"myIGW": {
"Type": "AWS::EC2::InternetGateway",
"Properties": {
"Tags": [
{
"Key": "Name",
"Value": "ntier-igw"
}
]
}
},
"AttachGateway": {
"Type": "AWS::EC2::VPCGatewayAttachment",
"Properties": {
"VpcId": {
"Ref": "myVpc"
},
"InternetGatewayId": {
"Ref": "myIGW"
}
}
},
"myRouteTable1": {
"Type": "AWS::EC2::RouteTable",
"Properties": {
"VpcId": {
"Ref": "myVpc"
},
"Tags": [
{
"Key": "Name",
"Value": "ntier-rt-1"
}
]
}
},
"forwardToIGW": {
"Type": "AWS::EC2::Route",
"Properties": {
"RouteTableId": {
"Ref": "myRouteTable1"
},
"DestinationCidrBlock": "0.0.0.0/0",
"GatewayId": {
"Ref": "myIGW"
}
}
},
"webrtasc": {
"Type": "AWS::EC2::SubnetRouteTableAssociation",
"Properties": {
"RouteTableId": {
"Ref": "myRouteTable1"
},
"SubnetId": {
"Ref": "webSubnet"
}
}
},
"datrtasc": {
"Type": "AWS::EC2::SubnetRouteTableAssociation",
"Properties": {
"RouteTableId": {
"Ref": "myRouteTable1"
},
"SubnetId": {
"Ref": "dataSubnet"
}
}
}
}
}

Comments

Popular posts from this blog

How to run Jenkins on Docker container | How to create Jenkins Volumes on Docker

POWERSHELL

Building game of life container