DevOps Journey Week 3: Networking Essentials, Mastering Shell Scripting, and EC2 Automation
Hey everyone! 🌟 I’m excited to share some highlights from my DevOps journey this week. I focused on improving shell scripting practices, discovering new Linux commands, automating EC2 deployment, and diving into computer networking basics—all essential for DevOps!
🌐 Networking Essentials: Breaking It Down
Learning networking basics has been another exciting part of my journey. Here’s what I’m covering:
OSI Model: This model breaks down how data moves from one device to another in seven layers, from physical hardware (like cables) to application protocols (like HTTP).
TCP/IP Model: Similar to OSI but simplified. It’s the foundation for all Internet-based communications.
CIDR Notation: CIDR (Classless Inter-Domain Routing) helps assign IP addresses more efficiently. Think of it as a method for organizing IP addresses in a way that helps manage large networks.
Subnets and DNS: Subnets break down a network into smaller sections, improving organization. DNS (Domain Name System) is what translates website names to IP addresses, making navigation easy.
NAT and VPC: NAT (Network Address Translation) allows private IPs to communicate with the internet. VPC (Virtual Private Cloud) enables creating isolated networks within the cloud, improving security.
📜 Shell Scripting Best Practices
This week was all about refining my shell scripting skills. Here’s what I explored:
Error Handling and Fallbacks: Adding error handling keeps scripts from failing unexpectedly. Here’s an example:
# Function to clone a git repo: suppose the repo name is "demo-app" code_clone() { echo "Cloning the github repo..." if [ -d "demo-app" ]; then echo "The code directory already exists. Skipping clone." else git clone <github_repo_link> || { echo "Failed to clone the code." return 1 } fi } # Clone the code if ! code_clone; then exit 1 fi
Here, the script checks if the
demo-app
directory exists before cloning. If it fails, it shows an error message and exits gracefully.Deploying Small Projects and Creating EC2 Instances: I wrote scripts to automate small project deployments and even created an EC2 instance with a script.
Check out the repository for this script here on GitHub. 🚀Useful Commands for Shell Scripting:
set -euo pipefail
: Ensures the script exits on errors (-e
), avoids unset variables (-u
), and prevents failed commands in pipes (-o pipefail
). This is helpful to avoid silent failures in complex scripts.
📝 Note: A Cool Command I Learned - command -v
One of the interesting things I picked up this week is the command -v
command, which is better than which
for checking if a command exists. Unlike which
, which doesn’t always check the current shell’s functions or built-ins, command -v
gives an accurate result of whether a command is available. This is really useful when automating installs or checking dependencies.
Example:
if ! command -v docker &> /dev/null; then
echo "Docker is not installed. Please install Docker to proceed."
exit 1
fi
This command checks if Docker is installed; if it’s missing, it gives a message and exits. Super handy for ensuring scripts have everything they need without silent failures!
🔍 What’s Next?
Over the next two weeks, I’ll continue to build on my current skills. Here’s what’s on the roadmap:
Practical Networking Setup: I’ll be practicing VPC setups, creating subnets, and testing out IP management for real-world experience. It’s all about creating hands-on configurations that mirror production setups.
Diving into Docker: I’ll be exploring Docker and some of its alternatives like Podman and rkt (rocket). Docker is a core DevOps tool for containerization, and understanding its alternatives helps in picking the right tool for different use cases. I plan to learn the full cycle, from Dockerfile creation to image management and deployment.
More Shell Scripting with Real Use Cases: Writing more complex scripts like deployment scripts, backup automation, and monitoring tools to solidify these skills.
Thanks for following along! 😄 Learning in public has been super rewarding, and I’m excited for the next steps in my journey.
Subscribe to my newsletter
Read articles from Abhishek Prajapati directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Abhishek Prajapati
Abhishek Prajapati
I am a passionate Software Engineer with over two years of experience in the tech industry, specializing in Full Stack Development and DevOps practices. Currently, I work on innovative projects in the automotive sector, where I develop and automate solutions that enhance user experience and streamline operations. With a keen interest in cloud technologies, automation, and infrastructure management, I am dedicated to mastering the DevOps landscape. I believe in simplifying complex concepts and sharing practical insights to help others in their learning journeys. Join me as I document my experiences, challenges, and triumphs in the world of DevOps!