Raj Saha Cloud With Raj: Instructor Bio
Raj Saha Cloud With Raj: Instructor Bio
Raj Saha Cloud With Raj: Instructor Bio
cloudwithraj.com
Cloud With Raj
linkedin.com/in/rajdeep-sa-at-aws/
Instructor Bio:
Sr. Specialist SA – Containers/Serverless@
Bestselling Udemy/Pluralsight author
Tech Advisor of crypto startup
Public speaker and guest lecturer
Author of multiple official AWS blogs
YouTuber with 35K subscribers
Previously - Distinguished Cloud Architect @Verizon
Opinions are my own
Copyright © Rajdeep Saha - All Rights Reserved
Course Structure
DevOps Fundamentals
DevOps Pre-requisites
Raj Saha
cloudwithraj.com
Cloud With Raj
store/browse
Monolith
API
store/buy Gateway/Load Entry function check the Database
Balancer url/path and executes logic
store/refund accordingly
CPU
Amazon EC2
(M5.12xlarge)
API Monolith
store/buy Gateway/Load Database
Balancer (Running on VM)
store/refund
CPU
Amazon EC2
(M5.12xlarge)
store/browse
Monolith
Monolith
(Running on VM)
API
store/buy Gateway/Load (Running on VM)
Database
Balancer
store/refund
CPU CPU
store/get backend DB
store/browse (smaller VM1) (t3.large)
API
store/buy store/post backend
Gateway/Load DB
(smaller VM2)
Balancer
store/refund
(t3.medium)
store/delete backend
(smaller VM3) DB
(t3.micro)
(t3.micro)
(t3.micro)
Polyglot
Copyright © Rajdeep Saha - All Rights Reserved
World is Moving towards Microservice
Code deployed every 11.7 seconds! Delivery time reduced from Code deployed thousand times per day
hours to minutes
Developer Operations
Developer Operations
Developer Operations
● Automate everything!
Raj Saha
cloudwithraj.com
Cloud With Raj
Raj Saha
cloudwithraj.com
Cloud With Raj
Raj Saha
cloudwithraj.com
Cloud With Raj
Remediate
Remediate
Raj Saha
cloudwithraj.com
Cloud With Raj
AWS Cloud9 AWS CodeCommit AWS CodeBuild AWS CodeBuild AWS CodeDeploy CloudWatch AWS X-Ray
AWS CodePipeline
Raj Saha
cloudwithraj.com
Cloud With Raj
AWS Cloud9 AWS CodeCommit AWS CodeBuild AWS CodeBuild AWS CodeDeploy CloudWatch AWS X-Ray
AWS CodePipeline
CloudWatch
app.java
CloudWatch
app.java app.java
Amazon EC2
AWS CodeArtifact
CloudWatch
app.java app.java
Amazon EC2
AWS CodeArtifact
CloudWatch
AWS CloudFormation
CloudWatch
WordPress
CloudWatch
app.java
app.java app.java
app.java app.java
app.java app.java
manifest
Amazon Elastic Kubernetes
Service (Amazon EKS)
Dockerfile Dockerfile Amazon Elastic Container
Registry (Amazon ECR)
app.java app.java
manifest
Amazon Elastic Kubernetes
Service (Amazon EKS)
Dockerfile Dockerfile Amazon Elastic Container
Registry (Amazon ECR)
Raj Saha
cloudwithraj.com
Cloud With Raj
Git Commands
Infrastructure as Code
(CloudFormation or Terraform)
Must Have
DevOps Services
(Jenkins Recommended)
DevOps Pipelines
(Workflows)
Relevant Technology
(Kubernetes Recommended)
Highly Recommended
Interview Q/A Practice
DevOps Job
Linux Commands Covered In This Course
CloudFormation Basics
DevOps Pipelines
(Multiple Workflows)
Kubernetes Primer
Highly Recommended
DevOps Interview Q/A
DevOps Job
Recommended Linux Commands (This Course)
Relevant Technology
Kubernetes
DevOps Job
How About Certs and Coding?
● Certs are good to get recruiter attention
● AWS Sysadmin Associate
● AWS DevOps Pro
● Kubernetes Certs
● Avoid super specific certs in the beginning
Raj Saha
cloudwithraj.com
Cloud With Raj
● Code security
● Static code analysis (SAST – Static Application Security Testing)
● Hardcoding passwords, SSH keys etc
● Poor secret management
● Code vulnerable to SQLInjection, Crosssite Scripting etc.
● Vulnerable package used
● Host security
● CIS Kubebench non compliance
● Vulnerable AMI
● Shift Left
● Left (Starting of a process) to right (End stage of a process)
● Code > Build > Test > Deploy > Monitor
● Start integrating security from early (left) phase
Private Subnet
Private Subnet
Amazon EC2 Amazon EC2
Appserver Appserver
Database
Private Subnet
Private Subnet
Database
Raj Saha
cloudwithraj.com
Cloud With Raj
● Popular workflows
● Infra as Code workflow
● EC2 applications
● Kubernetes applications
CloudWatch
CloudWatch
CloudWatch
app.java app.java
Amazon EC2
app.java app.java
Amazon EC2
• Static code analysis • Penetration • Dynamic
testing testing and
• Use AWS Secrets analysis
Manager • DDoS testing
• Sample tools
• Sample tools – – ZAP, Astra,
SonarQube, graudit etc. Invicti etc.
app.java app.java
Amazon EC2
• Static code analysis • Penetration • Dynamic
testing testing and
• Use AWS Secrets analysis
Manager • DDoS testing
• Sample tools
• Sample tools – – Astra, Invicti
SonarQube, graudit etc. etc.
• How is the app exposed?
• Can be invoked via shell • Monitor host
• Use private subnet, AWS commands configuration
WAF, AWS Shield, AuthN/Z
Infrastructure
security
https://aws.github.io/aws-eks-best-practices/security/docs/
Git – What and Why
Raj Saha
cloudwithraj.com
Cloud With Raj
Before Version Control System
Version 1.0
Before Version Control System
Version 1.0
Before Version Control System
Version 1.0
Version 1.0
I have a great
idea, send me
your code
Version 2.0
Before Version Control System
Version 1.0
Version 2.0
Before Version Control System
Version 1.0
Version 2.0
Before Version Control System
Version 1.0
• No audit tracking
Version 2.0
Version Control System
v1.0
Repository
Version Control System
v1.0
Repository
Version Control System
v1.0
Repository
Version Control System
v1.0
v1.0
Repository
Version Control System
v1.0
v2.0
Repository
Version Control System
v2.0
v1.0
v1.0
Repository
Version Control System
v2.0
v1.0
v2.0
Repository
Version Control System
v2.0
v1.0
v2.0
Repository
Version Control System
v2.0
v1.0
v2.0
Repository
Version Control System - Git
v2.0
Why Git?
v1.0 • Distributed
v1.0
Repository
Centralized Version Control System
Centralized
Repository
Local Repository
Local Repository
Distributed Version Control System
Local Repository
v1.0
Local Repository
v1.0
Local Repository
Version Control System
Why Git?
• Distributed
• Performant
• Open source
• Free!
• Implemented with Kubernetes GitOps,
integration with Jenkins and other DevOps
tools
• GitHub, GitLab, Code Commit are all based
on Git
Git vs GitHub
Raj Saha
cloudwithraj.com
Cloud With Raj
Git Vs. GitHub
v1.0
Local Repository
v1.0
Local Repository
Ways to use Git
GUI
GUI
Git Graph
Repository
GitHub
Raj Saha
cloudwithraj.com
Cloud With Raj
Distributed Version Control System
Local Repository
v1.0
v1.0
Remote
Repository
Distributed Version Control System
Local Repository
v1.0
Remote
Repository
Git Workflow
file1
Local
Git Workflow
file1
add
Local
Git Workflow
file1
add commit
Local
Git Workflow
file1 file1
add commit
Local
Git Workflow
git push
Git Workflow
file1
file1 file1 file1
file2
file1
Modified file1 file1 file1
file2
file1
Modified file1 file1 file1
git add -A
file2 file2
file1
Modified file1 Modified file1 file1
file1
Modified file1 Modified file1 Modified file1
file1
Modified file1 Modified file1 Modified file1
git push
file3 file3 file3 file3
git push
file3 file3 file3
git push
file2 file2 file2 file2
git push
file2 file2 file2 file2
• Each commit will have separate ID, full snapshot with details for
audit
Skipping the Staging Area
file7
NOT RECOMMENDED
Git Branch and Merge
Raj Saha
cloudwithraj.com
Cloud With Raj
file3 file3 file3 file3
I am working on
a new feature
feature1
file1
Branch: master
Branch: feature1
file1
Branch: master
Merge
Pull Request
Branch: feature1
Branch: master
Commit ID
for file1
• Branch can only be created
from existing branch
Branch: master Branch: feature1
Commit ID
for file1 • Important - Branches are
references to commit, no code
is copied
Commit ID
for file1
Modified file1
Branch: feature1
Commit ID
for modified file1,
index.html
Branch: master
Commit ID
for file1
Modified file1
Added index.html
Changes in Multiple Branches
Commit ID
for file1
Committed file2
in master
Changes in Multiple Branches
Committed file2
• Need three-way merge
in master
Fast Forward Merge Not Possible
Branch: master
Branch: feature1
Commit ID Commit ID
for file2 for modified file1,
index.html
Commit ID
for file1
Fast Forward Merge Not Possible
Branch: feature1
Branch: master
Commit ID Commit ID
for file2 for modified file1,
index.html
Commit ID
for file1
Recursive Three-Way Merge
Commit ID
for file1
Commit ID
for file1
Commit ID
for file1
Commit ID
for file1
Branch: feature2
Branch: master Branch: feature1
Commit ID Commit ID
for file2 for modified file1,
index.html
Commit ID
for file1
Commit ID
for file1
Branch: feature2
Branch: master Branch: feature1
Commit ID Commit ID
for file2 for modified file1,
index.html
Commit ID
for file1
Raj Saha
cloudwithraj.com
Cloud With Raj
Raj Saha
cloudwithraj.com
Cloud With Raj
● Switch user
Raj Saha
cloudwithraj.com
Cloud With Raj
● Pinging an IP or domain
● Curl verbose
Copyright © Rajdeep Saha - All Rights Reserved
POST Method
● Postman
Copyright © Rajdeep Saha - All Rights Reserved
Networking Commands – API Endpoint
Raj Saha
cloudwithraj.com
Cloud With Raj
Raj Saha
cloudwithraj.com
Cloud With Raj
Raj Saha
cloudwithraj.com
Cloud With Raj
● https://docs.aws.amazon.com/cli/latest/reference/
● https://docs.aws.amazon.com/cli/latest/reference/
Raj Saha
cloudwithraj.com
Cloud With Raj
Everything
working
great! I am
genius!
Code Code
Dependencies Dependencies
Configuration Configuration
In The Beginning
Environment: Dev Environment: Test Environment: Prod
Need to
change the
code. I guess
it’s okay.
Runtime Engine: Python 3.8 Runtime Engine: Python 3.6 Runtime Engine: Python 2.7
Why did I
take this job
Runtime Engine: Python 3.8 Runtime Engine: Python 3.6 Runtime Engine: Python 2.7
Build Run
Amazon EKS
Dockerfile
Your App Repository
Dockerize Deploy Into
App Container Google Kubernetes Engine
Docker Image K8s Cluster
Docker Hub
K8s on EC2
……..
Elastic Container Registry Any other K8s Cluster
(ECR) Implementation
Virtual Machine Vs Container
VM
Build Run
Why did I
take this job
Runtime Engine: Python 3.8 Runtime Engine: Python 3.6 Runtime Engine: Python 2.7
Life is great
again!
Code
import requests
import kitchen-sink Docker Image
Dependencies
Runs seamlessly in Dev, Test, Prod
DNS Service Name
Database connection
Configuration
Advantages
Build Run
● Docker packages software into standardized units called containers that have
everything your software needs to run including libraries, code and runtime
● Lets you quickly deploy and scale applications into any environment
What is Container Orchestrator?
How Does Docker Work?
EC2s are like hyenas, if you see one, other ones are nearby.
● Deployment of Containers
● Redundancy and availability of Containers
● Scaling up or down of Containers
● Load Balancing
● Health Monitoring of Containers and Hosts
● Service Discovery
● And More...
Container Orchestrator
Say Hello to Container Orchestrators
● Docker Swarm
● Apache Mesos
● Kubernetes
○ EKS (Elastic Container Service for Kubernetes)
● AWS Fargate
What is
Kubernetes?
(The most popular Container Orchestrator)
Working Backwards
Build Run
Key Value Store for critical cluster info Ensures proper state of cluster components
X
Who Specifies State?
YOU
Manifest File
Run 6 copies of an container image
Who Specifies State?
YOU
Manifest File
Run 6 copies of an container image
Gateway to Control Plane
Key Value Store for critical cluster info Ensures proper state of cluster components
Key Value Store for critical cluster info Ensures proper state of cluster components
Kubernetes
8 Letters
K8s
Pods
Pods
The Big Picture
K8 Cluster
Docker Hub
POD
Container
NODE K8 Cluster
Webserver
Nginx Nginx
10.16.48.53 10.16.93.80
Life Of A Simple Pod
10.16.10.01
Webserver
Nginx Nginx
10.16.48.53 10.16.93.80
10.18.10.21
Database
Redis Redis
10.18.32.61 10.18.16.23
Deployment
Deployment
+
Rolling Update
+
Replicaset
Pods In Real World
Webserver
Nginx:1.16 Nginx:1.16
X
Nginx:1.16 Nginx:1.16
Deployment Restores Replicaset
Deployment will restore replicaset with
running pods - super fast!
X
Nginx:1.16 Nginx:1.16 Nginx:1.16
Deployment Rolling Update
Original New
AWS Console
CloudFormation
Amazon Elastic Container
AWS CLI
Service for Kubernetes
eksctl CLI
Learning Medium
AWS Console
CloudFormation
AWS CLI
Amazon Elastic Container
Service for Kubernetes
eksctl CLI
AWS Console
CloudFormation
AWS CLI
Amazon Elastic Container
Service for Kubernetes
eksctl CLI
DevOps Tools
What is eksctl?
● CLI tool for creating clusters on EKS
● Easier than console, for real!
● Abstracts lots of stuff - VPC, Subnet, Sec. Group etc.
using CloudFormation
eksctl create cluster --name <name> --version 1.15 --node-type Create EKS Cluster with K8 version 1.15 with 2 t3.micro
t3.micro --nodes 2 nodes
Raj Saha
cloudwithraj.com
Cloud With Raj
CircleCI
5%
Teamcity Jenkins
8% 64%
Source: https://www.datanyze.com/market-share/ci--319/jenkins-market-share
Copyright © Rajdeep Saha - All Rights Reserved
Why Jenkins?
● Open-source CI/CD tool for DevOps
● Started in 2004
● Package flexibility
● Run in your machine, on-prem, EC2, Docker, Fargate,
Kubernetes and more!
● Cloud agnostic
● Superior integration with numerous tools for all DevOps phases
● Vibrant community
● 1800+ plugins
● Easy to find quickstarts, workshops, and examples
● Extensive Q/A lists and documentation
● Enterprise offerings built on top
● Constantly evolving and progressing with technology
Salary Data:
https://www.payscale.com/research/US/Skill=Jenkins/Salary
https://www.upgrad.com/blog/jenkins-salary-in-india-for-freshers-experienced/
Job Info:
LinkedIn Jobs
Raj Saha
cloudwithraj.com
Cloud With Raj
Amazon EC2
Jenkins
Raj Saha
cloudwithraj.com
Cloud With Raj
Raj Saha
cloudwithraj.com
Cloud With Raj
Raj Saha
cloudwithraj.com
Cloud With Raj
Raj Saha
cloudwithraj.com
Cloud With Raj
● Require Helm
Raj Saha
cloudwithraj.com
Cloud With Raj
app.py
Amazon EC2
GitHub
Amazon EC2
GitHub EC2 needs to have
• Python installed
• Pytest installed
• Version sensitive
app.py app.py
Amazon EC2
GitHub
• Test Container
• Pytest installed
app.py app.py
Amazon EC2
GitHub EC2 only needs Docker
installed
Raj Saha
cloudwithraj.com
Cloud With Raj
Raj Saha
cloudwithraj.com
Cloud With Raj
CICDJOB_UAT
CICDJOB_UAT
CICDJOB_STAGE
CICDJOB_PROD
CICDJOB_UAT
��� � ���ð ��
CICDJOB_STAGE
CICDJOB_PROD
Raj Saha
cloudwithraj.com
Cloud With Raj
Raj Saha
cloudwithraj.com
Cloud With Raj
Raj Saha
cloudwithraj.com
Cloud With Raj
Raj Saha
cloudwithraj.com
Cloud With Raj
Raj Saha
cloudwithraj.com
Cloud With Raj
Raj Saha
cloudwithraj.com
Cloud With Raj
Code
docker build
Container Image
(in Jenkins Agent)
Dockerfile
Docker Build and Push Flow
Code
Dockerfile
Docker Build and Push Flow
Code
docker logout
Dockerfile
Execute Lambda (or ANY AWS
Service!) from Jenkins
Raj Saha
cloudwithraj.com
Cloud With Raj
Raj Saha
cloudwithraj.com
Cloud With Raj
Branch: main
Modified file1
Calling API
Modified file1
Webhook to notify
Jenkins
Branch: main
Modified file1
Webhook
Branch: main
Modified file1
Raj Saha
cloudwithraj.com
Cloud With Raj
1 2 Amazon ECR
GitHub
Dockerfile Buildspec deploys image
Manifest
Developer AWS CodeBuild
4
AWS CodeCommit
Amazon EKS
1 2 3 CI
4 CD
X
kubectl apply -f
Hands-on guy
with access to live Amazon EKS
cluster
1 2 Amazon ECR
GitHub
Buildspec deploys image
Developer AWS CodeBuild
4
AWS CodeCommit
Amazon EKS
BUT
• ONLY AFTER SOMEONE DETECTS SOMETHING IS AMISS
• Re-running CD components is tedious, sometimes manual and error prone
1 2 Amazon ECR
GitHub
Buildspec deploys image
Developer AWS CodeBuild
4
AWS CodeCommit
Amazon EKS
1 2 3 CI
4 CD
Dockerfile GitHub
Manifest
Developer AWS CodeBuild Amazon ECR
CI
Code Repo I am more of a
cat person
GitHub
GitOps Tool
Amazon ECR
X
Manifest/Helm
Amazon EKS
1. Deviates from desired state defined in Git
2. Flux immediately reverts to state defined in
manifest files in Git
3. Sends alert to appropriate team with trails
4. Remove unnecessary access, only GitOps can
make changes
Amazon ECR
AWS CodeBuild
Gitops
AWS CodeCommit GitHub
Amazon EKS
Code Repo
Amazon ECR
Changes the container
image in a deployment
GitHub
Manifest/Helm
Amazon EKS
1. Deviates from desired state defined in Git
2. Flux modify the manifest file in Git and update the
container image
3. Only advisable in Development, NOT in Staging or
Prod
app.py
GitHub
Repo - kubernetescode
app.py
1
GitHub
Repo - kubernetesmanifest
deployment.yaml
Copyright © Rajdeep Saha - All Rights Reserved
GitOps Flow
Job - buildimage test:10
Build Docker
2 Container Image
app.py
Repo - kubernetescode
3
Job - updatemanifest
test:10
Updates image in
deployment.yaml
1
GitHub
Repo - kubernetesmanifest
Deploys
deployment.yaml
Gitops
4
deployment.yaml
(references test:10)
Copyright © Rajdeep Saha - All Rights Reserved
GitOps Flow
Job - buildimage
test:11
test:10
Build Docker
2 Container Image
app.py
Repo - kubernetescode
3
Job - updatemanifest
test:11
test:10
Updates image in
deployment.yaml
1
GitHub
Repo - kubernetesmanifest
Deploys
deployment.yaml
Gitops
4
deployment.yaml
test:11)
(references test:10)
Copyright © Rajdeep Saha - All Rights Reserved
Traditional DevOps
Job - buildimage test:11
Build Docker
2 Container Image
app.py
Repo - kubernetescode
3
Job - updatemanifest
test:11
Updates image in
deployment.yaml
1 4
GitHub
Repo - kubernetesmanifest
deployment.yaml
test:11)
(references test:10)
Copyright © Rajdeep Saha - All Rights Reserved
GitOps Flow
Job - buildimage test:11
Build Docker
2 Container Image
app.py
Repo - kubernetescode
3
Job - updatemanifest
test:11
Updates image in
deployment.yaml
1
GitHub
Repo - kubernetesmanifest
Deploys
deployment.yaml
Gitops
4
deployment.yaml
test:11)
(references test:10)
Copyright © Rajdeep Saha - All Rights Reserved
In Summary
• Periodically syncs the running cluster with
the desired state in Git Repo
• Works with both vanilla manifest files or
Helm charts
• Reduced learning curve than DevOps
GitHub • Increased security
• CI (Developer) and CD (Ops) permissions
are separated
• Less number of components
• GitOps doesn’t mean getting rid of DevOps
Amazon EC2
GitHub
index.html
Amazon EC2
GitHub
Amazon EC2
GitHub
Amazon EC2
GitHub
https://aws.amazon.com/blogs/containers/using-eks-encryption-provider-support-for-defense-in-depth/
Raj Saha
cloudwithraj.com
Cloud With Raj
Raj Saha
cloudwithraj.com
Cloud With Raj
Raj Saha
cloudwithraj.com
Cloud With Raj
• Scale
• Educate people about process, and technology
• Process – cost control, incident management, securing workload
• Technology – Infra as code, CI/CD, Container orchestration
• Mass migration