<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Gokul Raj</title>
    <description>The latest articles on DEV Community by Gokul Raj (@gokul98raj).</description>
    <link>https://dev.to/gokul98raj</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F880329%2Feb29694d-92b8-49f8-a1fa-9e172b82eae4.png</url>
      <title>DEV Community: Gokul Raj</title>
      <link>https://dev.to/gokul98raj</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/gokul98raj"/>
    <language>en</language>
    <item>
      <title>VPC using Terraform</title>
      <dc:creator>Gokul Raj</dc:creator>
      <pubDate>Thu, 27 Jul 2023 20:24:48 +0000</pubDate>
      <link>https://dev.to/gokul98raj/vpc-using-terraform-1m8c</link>
      <guid>https://dev.to/gokul98raj/vpc-using-terraform-1m8c</guid>
      <description>&lt;p&gt;Create a VPC from scratch using Terraform (Infrastructure as a Code)&lt;/p&gt;

&lt;p&gt;In this blog, we are going to build a VPC infrastructure with Public and Private subnets that span across all the availability zones (AZ) in a region and make reach public subnets to the internet with the help of an internet gateway.&lt;/p&gt;

&lt;p&gt;Source Code — &lt;a href="https://github.com/gokul98raj/Terraform-vpc"&gt;Click Here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--y57MKbda--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/19e9jw3z6k7mr4cx6mr0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--y57MKbda--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/19e9jw3z6k7mr4cx6mr0.png" alt="VPC" width="721" height="561"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;AWS following components which we required to create for this setup,&lt;br&gt;
VPC&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;1 Internet Gateway&lt;/li&gt;
&lt;li&gt;3 Public Subnets, one in each AZ&lt;/li&gt;
&lt;li&gt;3 Private Subnets, one in each AZ&lt;/li&gt;
&lt;li&gt;Route table configurations&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let's get started to build a VPC with Terraform in AWS by following the steps.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 1 - Create a VPC&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To begin with VPC resource in Terraform. To specify a range of IP addresses in a VPC, a CIDR block needs to be provided. We have also provided a Name tag for identification.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;variable "vpc_cidr" {
  description = "CIDR Value"
  default     = "10.0.0.0/16"
}`

`resource "aws_vpc" "vpc_main" {
  cidr_block       = var.vpc_cidr
  instance_tenancy = "default"

  tags = {
    Name = vpc_main
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 2 - Create Public and Private subnets&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Firstly, we identify the CIDR ranges to be associated with the six new subnets we need to create. In our example, based on the CIDR range of the VPC I have identified the CIDR ranges and defined a couple of variables in our Terraform code (variables.tf).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;variable "public_subnets_cidr" {
  type        = list(string)
  description = "Public Subnets"
  default     = ["10.0.1.0/24", "10.0.2.0/24", "10.0.3.0/24"]

}

variable "private_subnets_cidr" {
  type        = list(string)
  description = "Private Subnets"
  default     = ["10.0.4.0/24", "10.0.5.0/24", "10.0.6.0/24"]

}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In a resource block, we should provide the subnet configurations which include CIDR blocks and AZ details.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;resource "aws_subnet" "public_subnets" {
  count             = length(var.public_subnets_cidr)
  vpc_id            = aws_vpc.vpc_main.id
  cidr_block        = element(var.public_subnets_cidr, count.index)
  availability_zone = element(var.availability_zone, count.index)

  tags = {
    Name = "Public Subnet ${count.index + 1}"
  }
}

resource "aws_subnet" "private_subnets" {
  count             = length(var.private_subnets_cidr)
  vpc_id            = aws_vpc.vpc_main.id
  cidr_block        = element(var.private_subnets_cidr, count.index)
  availability_zone = element(var.availability_zone, count.index)

  tags = {
    Name = "Private Subnet ${count.index + 1}"
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 3 - Create an Internet Gateway&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Internet gateway will access the subnets to the internet. since we are using public subnets, we need to provide access to the internet in the given VPC.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;resource "aws_internet_gateway" "igw" {
  vpc_id = aws_vpc.vpc_main.id
tags = {
    Name = "vpc_main_igw"
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 4 - Create Route Table and RT association&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;However, the route table is an important aspect of making the resource communicate with each other. By default, VPC has a local route table created when VPC is created. Now are going to create a new route table with a destination of the internet gateway and associate it with public subnets to get internet access.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;resource "aws_route_table" "public_rt" {
  vpc_id = aws_vpc.vpc_main.id

  route {
    cidr_block           = "0.0.0.0/0"
    gateway_id = aws_internet_gateway.igw.id
  }

  tags = {
    Name = "Public Route "
  }

}

resource "aws_route_table_association" "public_rt_association" {
  count          = length(var.public_subnets_cidr)
  subnet_id      = element(aws_subnet.public_subnets[*].id, count.index)
  route_table_id = aws_route_table.public_rt.id

}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We have now successfully implemented the VPC design represented in the diagram using Terraform.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Will catch up on upcoming blogs…&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>terraform</category>
      <category>vpc</category>
      <category>aws</category>
      <category>infrastructureascode</category>
    </item>
    <item>
      <title>Instance Types (EC2)</title>
      <dc:creator>Gokul Raj</dc:creator>
      <pubDate>Sun, 18 Sep 2022 17:13:09 +0000</pubDate>
      <link>https://dev.to/gokul98raj/instance-types-ec2-dgn</link>
      <guid>https://dev.to/gokul98raj/instance-types-ec2-dgn</guid>
      <description>&lt;p&gt;We are going to explore the EC2 Instance types as long as we can.&lt;/p&gt;

&lt;p&gt;AWS Provides wide range of selection of instance to fit different requirements and use cases. Instance types are combination of compute, memory and networking capacity and provides flexibility to choose appropriate mix of resources based on our requirement.&lt;/p&gt;

&lt;p&gt;Instance Types of categorized among five types,&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;General Purpose&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Compute Optimized&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Memory Optimized&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Accelerated Computing&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Storage Optimized&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let’s see all the family types,&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;General Purpose&lt;/strong&gt;&lt;br&gt;
General purpose instances provide a balanced with all aspects of CPU, Memory and networking resources. So we can use for variety of workloads.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Compute Optimized&lt;/strong&gt;&lt;br&gt;
Compute Optimized instances are core of compute based application that benefits from high performance processors. Instances belonging to this family are suited for high compute performance for batch processing, machine learning and other compute intensive applications.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Memory Optimized&lt;/strong&gt;&lt;br&gt;
Memory Optimized instances are designed to provide fast performance for large set of memory.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Accelerated Computing&lt;/strong&gt;&lt;br&gt;
Accelerated computing instances that are use hardware accelerators to perform Graphics Processing, Data pattern matching, etc. Also it‘s well suitable for GPU based application.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Storage Optimized&lt;/strong&gt;&lt;br&gt;
Storage optimized instances are used for storage intensive workloads in Amazon EC2. This type of instance are comes with instance storage by default. Storage attached with instances physically and it’s called instance storage.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--vqpa25Su--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w4ws3naf5o6za4gebqp8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--vqpa25Su--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w4ws3naf5o6za4gebqp8.png" alt="EC2 Instances Types" width="880" height="662"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;You can find more about instance details &lt;em&gt;&lt;a href="https://aws.amazon.com/ec2/instance-types/"&gt;here&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>aws</category>
      <category>ec2</category>
      <category>ec2instance</category>
      <category>cloudcomputing</category>
    </item>
    <item>
      <title>Elastic Compute Cloud (EC2)</title>
      <dc:creator>Gokul Raj</dc:creator>
      <pubDate>Thu, 18 Aug 2022 20:32:40 +0000</pubDate>
      <link>https://dev.to/gokul98raj/elastic-compute-cloud-ec2-6if</link>
      <guid>https://dev.to/gokul98raj/elastic-compute-cloud-ec2-6if</guid>
      <description>&lt;p&gt;EC2 is an important services in AWS cloud which offering compute, Storage, Network &amp;amp; Security, Load Balancing and Auto scaling features. These are the essentials to deploy the basic workloads to the cloud.&lt;/p&gt;

&lt;p&gt;Lets talk about the features of the EC2 briefly,&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Compute:&lt;/strong&gt;&lt;br&gt;
Virtual machine is known as Instance in AWS, AWS supports all the major Operating Systems (OS) Starting with Windows, Linux, Mac, etc. AWS provides different types instance launch types based on our requirements, we can optout whichever suitable for us.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Instance Launch Types:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;On Demand Instances&lt;/li&gt;
&lt;li&gt;Reserve Instances&lt;/li&gt;
&lt;li&gt;Spot Instances&lt;/li&gt;
&lt;li&gt;Dedicated Instances&lt;/li&gt;
&lt;li&gt;Dedicated Hosts&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;On Demand:&lt;/strong&gt;&lt;br&gt;
Deploy the instances for short workloads and predictable pricing, so that we can deploy and terminate whenever we want.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Reserve Instances:&lt;/strong&gt;&lt;br&gt;
This type of instances are minimum reserved by one year, so that the pricing of the instance could be majorly decrease and save the billings.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Spot Instances:&lt;/strong&gt;&lt;br&gt;
This instances is uses spare EC2 instances capacity that is available for very cheaper and provide based on hourly price called Spot price. Spot Instance runs whenever capacity is available. We can run based on short workloads and high intense compute requirements.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Dedicated Instances:&lt;/strong&gt;&lt;br&gt;
Your instances are running with a separate hardware which no other customer will share the resource.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Dedicated Hosts:&lt;/strong&gt;&lt;br&gt;
This type is such as book the entire physical host and fully dedicated to customer use. they can configure all things based on their needs.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Storage:&lt;/strong&gt;&lt;br&gt;
Storage is known as EBS — Elastic Block Storage in EC2, EBS is a block-level storage volumes that you can attach to a running instance. There are different types of volumes are available in storage and choose whatever combination to suit your requirements.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Types of Volume:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Solid State Drive&lt;/li&gt;
&lt;li&gt;Hard Disk&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--o5UNGAzD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gwrhqv5ua3o02fjgdn85.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--o5UNGAzD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gwrhqv5ua3o02fjgdn85.png" alt="Image description" width="687" height="522"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;General Purpose:&lt;/strong&gt;&lt;br&gt;
General Purpose SSD volumes are backed by solid-state drives (SSDs). They balance price and performance for a wide variety of transactional workloads.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Provisioned IOPS:&lt;/strong&gt;&lt;br&gt;
Provisioned IOPS SSD volumes are backed by solid-state drives (SSDs). They are the highest performance which EBS storage volumes designed for critical, IOPS-intensive, and throughput-intensive workloads that require low latency.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Throughput Optimized:&lt;/strong&gt;&lt;br&gt;
A low-cost HDD designed for frequently accessed, throughput-intensive workloads.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Cold HDD:&lt;/strong&gt;&lt;br&gt;
A low-cost HDD designed for less frequency accessed workloads.&lt;/p&gt;

&lt;p&gt;We will see the storage on upcoming blogs in detail.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Load Balancer:&lt;/strong&gt;&lt;br&gt;
Load balancer is known as Elastic Load Balancer in AWS, It’s a service which helps us to distribute the incoming application traffic to across multiple targets. This increases the availability of the Application and servers.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Types of Load Balancers:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Application Load Balancer&lt;/li&gt;
&lt;li&gt;Network Load Balancer&lt;/li&gt;
&lt;li&gt;Gateway Load Balancer&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Application Load Balancer:&lt;/strong&gt;&lt;br&gt;
This type of load balancer use for HTTP and HTTPS traffic. The load balancer routes based on the content of the request. It’s acts on Presentation layer in OSI reference model.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Network Load Balancer:&lt;/strong&gt;&lt;br&gt;
This type of load balancer use for TCP, UDP, and TLS traffic where extreme performance is required. It’s acts on Network layer in OSI reference model.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Gateway Load Balancer:&lt;/strong&gt;&lt;br&gt;
This type of load balancer use to deploy, scale, and manage virtual appliances, such as firewalls. It’s acts on Network layer in OSI reference model.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Auto Scaling Group:&lt;/strong&gt;&lt;br&gt;
Auto scaling helps the EC2 instances which scales automatically based on the defined situation. Scaling policy is defines the configurations of scaling the instances. Desired instance and Maximum instance configuration is a key factor. Before that we should configure launch template or launch configuration.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Types of Scaling:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Target Tracking Scaling&lt;/li&gt;
&lt;li&gt;Simple/Step Scaling&lt;/li&gt;
&lt;li&gt;Scheduled Scaling&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Target Tracking Scaling:&lt;/strong&gt;&lt;br&gt;
This type of scaling that we specify Cloud Watch metric and a target value that represents the ideal average utilization or throughput level for your instances.&lt;br&gt;
Eg:- I Want the average CPU to stay around 60%&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Simple/Step Scaling:&lt;/strong&gt;&lt;br&gt;
This type of scaling that we choose scaling metrics and threshold values for the Cloud Watch alarms that invoke the scaling process.&lt;br&gt;
Eg:- We want to scales the Memory &amp;gt; 70%&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Scheduled Scaling:&lt;/strong&gt;&lt;br&gt;
This type of scaling is helps to set up our own scaling schedule according to predictable load changes.&lt;/p&gt;

</description>
      <category>aws</category>
      <category>cloud</category>
      <category>ec2</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
