Posts

Showing posts from 2024

SRE/DevOps Syllabus

Image
  DEVOPS/SRE Principles. Git What is Git? Architecture of Git. Working principle of Git. Create and cloning a repo. Version control branching. Version control commit. Version control managing workflows. Git hooks. Git Reflog. Git Stash. Git Cherry Picking. Undoing changes in different states of Git. Git based terraform template management. AWS CI/CD SDLC Automation. Code Commit. Code Build. Code Deployment. Code Pipeline. Elastic Beankstalk. Code Artifact. CodeGuru. Terraform Terraform Basics. Terraform State. Working with Terraform. Terraform with AWS. Remote State. Terraform Provisioners. Terraform Import, Tainting and Debugging. Terraform Modules. Terraform Functions and Conditional Expressions. Automation using Python - AWS AWS lambda. Automating EC2 with Lambda. Automating S3 with Lambda. Automating VPC with Lambda. Cost optimization with Lambda. SNS,SQS and SES with Python. Managing and Automating AWS Security with Python. Kubernetes - CKAD Application Developer. Kubernetes A...

AWS - Code Signer

Image
  AWS Lambda code signing is the practice of digitally signing source code packages for functions and layers. The goal of code signing is to ensure that only trusted code runs in your AWS Lambda functions. AWS Signer is a fully-managed code-signing service that can be used to verify the integrity of your AWS Lambda code. Before your code is deployed, AWS Lambda will perform a series of validation checks which will determine whether to accept or reject the deployment package. The first step in the code signing process is to define Amazon S3 source and destination buckets. AWS Signer retrieves unsigned packages from the S3 source bucket, performs the signing job on the package, then deposits the signed package in the S3 destination bucket. We create a S3 bucket with 2 folders. unsigned code  holds normal zip files. Creating a signing profile: Under profile, we mention the signing platform and validity period. Once the profile is created, "Start signing job". Here, we mention...

AWS Dynamodb Series - I

Image
  In this series, we will cover about AWS Dynamo DB. As the name suggests, its a database but NOSQL database. NOSQL means its not only SQL.  Dynamo DB can store structured and unstructure data. But the same must be in Key Value format (Dictionary format). Let' see how to create a table. Most important and must have in a dynamodb table is the "Partition or Primary Key".   Partition key is a common term used across any storage space. It is widely used for better query execution and better clubbing of data. With partition key, we can avoid scanning entire table and speed up the query exection. Dynamodb store the table data in partitions.  I selected “department” as the primary key. “student_name” as the sort key which is optional. Sort key, as the same says it is used in conjunction with the primary key to sort the items. I am going with "Default settings" and selecting Standard storage class. Selecting Read/Write capacity settings as "On-demand" . Not se...

DevOps Interview Q&A

Image
  1. How does GitLab trigger pipelines automatically when a developer pushes code?    Git triggers build the moment developer commits to the respective branch.    It works based on hook(push events). 2. How do you declare dependent stages in a CI/CD YAML file?  Use stages for ordering and needs for explicit dependencies. 3. What is terraform init? terraform init: Initializes the environment by setting up the backend, downloading providers, and modules. 4. What is backend.tf? backend.tf: Defines the backend configuration, which tells Terraform where to store the state file (local or remote). 5. What does terraform plan do? terraform plan essentially performs a "dry run" of the changes, allowing you to review what will happen before you apply them. 6. What happens if you give the wrong configuration or code in Terraform and run it? It depends. Syntax error will fail at the plan phase, else resources will get created.  If the resource already exist in sta...

AWS LB - QnA

Image
  ***AWS Load Balancer interview Question*** 1. What are the different types of Load Balancers provided by AWS? Classical Load Balancer - Deprecated. Application Load Balancer. Network Load Balancer. 2. When would you choose ALB over NLB or CLB? ALB - Primarily works in the Application Layer. Supports HTTP layer customization like path based forwarding, Host header, HTTP request method, Source IP based routing. NLB - Operates at Networking layer. Provide much better performance compared to ALB. NLB's target group can be an ALB. 3. How does path-based routing work in an Application Load Balancer? Path based routing allows to route traffic based on the request path. E.g., If your domain name is www.example.com, we can configure path based routing like www.example.com /welcome www.example.com /signin Path based traffic can be routed to a "Target Group", "Redirect to URL", "Return Fixed Response". 4. How does AWS Auto Scaling integrate with Elastic Load Ba...

Does Target Group Updates Instances Dynamically?

Image
  We all know what is a target group, it is a pool of EC2 instances. It sits between the load balancer and ASG. When you add EC2 instances to the target group manually which is registering and deregistering EC2 instance. But in real time, we don't register/deregister manually. For this we need to create an EMPTY TARGET GROUP and attach the load balancer and refer that load balancer to the ASG. I created an empty target group. Attached this a load balancer and associated the load balancer to the ASG. Now we have an EC2 instance created and it gets registered automatically with the target group. Let’s terminate the instance and ASG will replace the instance. This should also update the target group dynamically. Now, we can see a new instance created in ASG. i-06f8b560ea0a3bbaa  Instance ID should be updated in target group. We can see the new instance updated dynamically. 

AWS - SQS Demo Python

Image
  Short demo on how to use Python to create a AWS SQS producer and consumer . All we need is a SQS queue and keep the SQS URL ready. I am using boto3 library to call SQS. # SQS producer code # Code generates random greeting message # We will feed random generates messages to SQS # Message will generated for every 10sec import random; import boto3; import time; from Sitecheck import response # Initialize boto3 SQS client sqs = boto3.client( 'sqs' ); # URL for the SQS queue = 'https://sqs.us-east-1.amazonaws.com/851725408580/demo-sqs'; # Producer Code def generate_welcome_message (): greetings = [ "Hello" , "Hi" , "Welcome" , "Howdy" , "Greetings" ] compliments = [ "nice to see you" , "great to have you here" , "welcome aboard" ] greeting = random.choice( greetings ) compliment = random.choice( compliments ) message_to_send = ( greeting + " " + compliment ); d...

AWS - Understanding Security Group

Image
  In this post will go in detail on a simple ALB to EC2 setup. I am configuring NodeJS on my EC2 instance. [root@ip-172-31-9-46 ~]# yum install npm [root@ip-172-31-9-46 ~]# npm install express Starting the application using the below command. [root@ip-172-31-9-46 ~]# node app.js App1 is listening on port 3000 App2 is listening on port 4000 Now, I configured a target group: In the target group we must give the application port and health check port . NOTE: We cannot mention any security group under Target group. Next, I am going to create a ALB. Our ALB listens on port 80. So the ABL DNS/welcome should route the traffic to backend machine. Eg: http:// demo-alb-123456.us-east-1.elb.amazonaws.com/welcome Now, our EC2 instance at the backend should accept traffic from ALB on port 3000/4000. Even though ALB has an IP address range which is dynamic, so create a security group based on IP is not the right solution. Hence, we will create a security group and attach to ALB. This ...