Posts

AWS: Highly available infrastructure using ASG and ELB

Building a Highly Available Environment on AWS using Auto Scaling Group and Load Balancer 1. Introduction Highly available infrastructure ensures that applications remain accessible even if one or more servers fail. In AWS, this can be achieved by combining: - EC2 Instances - Auto Scaling Group (ASG) - Elastic Load Balancer (ELB) - Health Checks This architecture automatically replaces unhealthy instances and distributes traffic across multiple servers. --- 2. Prerequisites Before starting the setup, ensure the following components are available. 2.1 AWS Account You must have access to the AWS Management Console. 2.2 VPC Setup A Virtual Private Cloud with: - At least two public subnets - Subnets in different Availability Zones Example: VPC ├── Subnet-A (Availability Zone 1) └── Subnet-B (Availability Zone 2) 2.3 Security Group Allow the following ports: HTTP (80) HTTPS (443) SSH (22) --- 3. Launch Base EC2 Instance First create a base EC2 instance which will la...

AWS: Monitor EC2 instance with cloudwatch alarms and email alerts

Step-by-Step Guide: Setup CloudWatch Agent on Linux EC2 with Alerts and SNS Notifications 1. Prerequisites Before starting the setup, ensure the following requirements are met. 1.1 EC2 Linux Instance You must have a running Linux EC2 instance. Supported operating systems include: - Amazon Linux - RHEL / Rocky Linux / CentOS - Ubuntu Example configuration: OS: Amazon Linux / RHEL / Ubuntu Instance type: t2.micro or above Internet access: Required 1.2 AWS Permissions The EC2 instance must have permission to push metrics and logs to CloudWatch. This is done using an IAM role. --- 2. Create IAM Role for CloudWatch Agent 1. Go to AWS Console 2. Open IAM 3. Click Roles 4. Click Create Role Select Trusted Entity Trusted entity: AWS Service Use case: EC2 Attach Permission Policy Attach the following policy: CloudWatchAgentServerPolicy Role Name EC2-CloudWatch-Agent-Role Create the role. --- 3. Attach IAM Role to EC2 Instance 1. Go to EC2 Dashboard 2. Select your EC2 in...

AWS: Serverless REST API (API Gateway + Lambda + DynamoDb + WAF)

Image
This project demonstrates a secure, scalable, and cost-efficient serverless REST API built using API Gateway, Lambda, DynamoDB, and protected by WAF. The architecture ensures high availability, automatic scaling, and IP-based access control for write operations, making it production-ready  Architecture: Client → API Gateway → Lambda → DynamoDB 🟢 STEP 1: Create DynamoDB Table: > Go to AWS Console > Search → DynamoDB > Click Create table Fill: Table name: users Partition key: Name: id Type: String Keep On-demand capacity > Click Create table ✅ Done. 🟢 STEP 2: Create IAM Role for Lambda: > Go to IAM > Click Roles > Click Create role > Select: Trusted entity: AWS Service Use case: Lambda > Click Next > Attach policies: AWSLambdaBasicExecutionRole AmazonDynamoDBFullAccess (For learning project. In real production, use limited custom policy.) > Name role: lambda-dynamodb-role > Click Create role ✅ Done. 🟢 STEP 3: Create Lambda Function > Go to La...

Terraform project with AWS to build infra within seconds! (Web Ec2 with eIP)

Image
1. Introduction: What is Terraform? Terraform is an open-source Infrastructure as Code (IaC) tool created by HashiCorp. It lets you define, provision, and manage cloud infrastructure using declarative configuration files . Instead of manually creating AWS resources in the console, you write code that describes what you want, and Terraform takes care of creating or updating it. Why use it with AWS? a) Infrastructure as Code (IaC) You can define AWS resources (EC2, VPC, S3, IAM, etc.) in .tf files. These configurations can be version-controlled in Git. b) Multi-Cloud Support Although AWS has its own tool (CloudFormation), Terraform works with AWS + Azure + GCP + on-prem at the same time. c) Reusability & Automation You can reuse Terraform modules to deploy the same AWS setup in different environments (dev, test, prod). d) State Management Terraform keeps a state file to know which resources it manages. Makes it easy to track and update changes in AWS without accidentally del...

Linux: BIOS vs UEFI

Image
  BIOS vs. UEFI: Boot System Comparison When a computer starts, it needs firmware to initialize hardware and boot the OS. There are two main types of firmware: BIOS (Basic Input/Output System) and UEFI (Unified Extensible Firmware Interface) . Let’s break them down: 1. BIOS (Basic Input/Output System) ✅ Best for: Older systems (pre-2010). Simplicity and compatibility with legacy OS. ❌ Limitations: Slow boot times. Only supports MBR partitioning (max 2TB disks). No mouse support , only keyboard navigation. 🛠️ How to Check if Your System Uses BIOS? If your boot screen has a text-based interface , it’s BIOS. Run this command in Linux: test -d /sys/firmware/efi && echo "UEFI" || echo "BIOS" If it prints BIOS , you are using BIOS. 2. UEFI (Unified Extensible Firmware Interface) ✅ Best for: Modern systems (post-2010). Faster boot times (supports Fast Boot ). Supports GPT partitioning (can use disks larger than 2TB). Secure Boot feature (prot...