---
title: "devops"
lang: "en"
author: "Mohammad Abu Mattar"
canonical: https://mkabumattar.com/categories/devops
---

[All Categories](/codesnippets/categories)

# Devops

[Home](/)›[All Snippets](/codesnippets)›[All Categories](/codesnippets/categories)›[Devops](/codesnippets/categories/devops)

Category

# Devops

LanguageAllBash (7)Python (5)Typescript (3)Bash and Python (1)Python, Node.js and Go (1)SQL and Python (1)CategoryAllDevops (9)Shell scripting (6)Aws (5)Automation (3)Productivity (3)Python (3)Backend (2)Database (2)Nodejs (2)Performance (2)Ai ml (1)Async (1)Bash (1)Cloud (1)Computer vision (1)Document processing (1)Linux (1)Networking (1)Security (1)Typescript (1)TagAllDevOps (7)Bash (6)Python (6)Shell Scripting (5)Automation (4)AWS (4)NodeJS (4)Performance (4)Configuration (3)TypeScript (3)Backend (2)Boto3 (2)CI/CD (2)Cloud (2)Concurrency (2)DevTools (2)Environment Variables (2)IAM (2)Linux (2)Microservices (2)POSIX (2)Productivity (2)S3 (2)Terminal (2)AI Models (1)Aiohttp (1)Asyncio (1)AWS SDK v3 (1)BestPractices (1)BigData (1)Caching (1)CloudSecurity (1)Computer Vision (1)Cron (1)CRUD (1)Database (1)DataScience (1)Document Processing (1)DocumentClient (1)Dotenv (1)DynamoDB (1)EC2 (1)Echo (1)Exponential Backoff (1)Flock (1)Go (1)HTTP (1)Indexes (1)Infrastructure (1)Locking (1)Machine Learning (1)MemoryOptimization (1)MLOps (1)MultiEnvironment (1)OCR (1)Open Source (1)Optimization (1)Pid file (1)PostgreSQL (1)Printf (1)QueryOptimization (1)Redis (1)Retry (1)Scripting (1)Scripting Best Practices (1)SecretsManagement (1)SecretsManager (1)Security (1)Shell (1)SQL (1)Text Recognition (1)Validation (1)Vault (1)Zod (1)Zsh (1)SortNewest firstOldest firstA to ZShortest read first

[![Bash Script Locking: Prevent Concurrent Runs with a PID File](/_astro/hero.CF-paSMK_vzFHW.webp)](/codesnippets/post/bash-script-locking-pid-file)

## [Bash Script Locking: Prevent Concurrent Runs with a PID File](/codesnippets/post/bash-script-locking-pid-file)

-   [Bash](/codesnippets/categories/bash)
-   [Automation](/codesnippets/categories/automation)
-   18 Aug 2026
-   04 Mins read

Quick Tip Wrap any script that must not run twice at once in a PID-file lock, and a second copy simply exits instead of corrupting your data. The Problem The Problem Cron does not c

[#Bash](/codesnippets/tags/bash)[#Pid file](/codesnippets/tags/pid-file)[#Locking](/codesnippets/tags/locking)+3 tags

[Bash](/codesnippets/bash)

[View Code](/codesnippets/post/bash-script-locking-pid-file)

[![Bash Retry Function: Automatically Retry Failing Commands with Exponential Backoff](/_astro/hero.Dap62rVN_Z1q0nar.webp)](/codesnippets/post/bash-retry-function-exponential-backoff)

## [Bash Retry Function: Automatically Retry Failing Commands with Exponential Backoff](/codesnippets/post/bash-retry-function-exponential-backoff)

-   [Devops](/codesnippets/categories/devops)
-   [Shell scripting](/codesnippets/categories/shell-scripting)
-   20 Jul 2026
-   05 Mins read

Quick Tip Wrap any flaky command in one reusable retry function and stop re-running red pipelines by hand. The Problem The Problem Some commands fail for reasons that have nothing to

[#Bash](/codesnippets/tags/bash)[#Retry](/codesnippets/tags/retry)[#Exponential Backoff](/codesnippets/tags/exponential-backoff)+3 tags

[Bash](/codesnippets/bash)

[View Code](/codesnippets/post/bash-retry-function-exponential-backoff)

[![AWS EC2 Instance Management with Boto3: Start, Stop, and Query Instances](/_astro/hero.PnHlvJay_ZkFqWG.webp)](/codesnippets/post/aws-ec2-instance-management-boto3-python)

## [AWS EC2 Instance Management with Boto3: Start, Stop, and Query Instances](/codesnippets/post/aws-ec2-instance-management-boto3-python)

-   [Cloud](/codesnippets/categories/cloud)
-   [Aws](/codesnippets/categories/aws)
-   14 Apr 2026
-   10 Mins read

If you've ever spent 20 minutes clicking through the AWS Console just to stop a handful of dev instances, you already know the pain. It's tedious, it doesn't scale, and one wrong click can ruin your a

[#AWS](/codesnippets/tags/aws)[#EC2](/codesnippets/tags/ec2)[#Boto3](/codesnippets/tags/boto3)+6 tags

[Python](/codesnippets/python)

[View Code](/codesnippets/post/aws-ec2-instance-management-boto3-python)

[![Multi-Environment Secret Management with HashiCorp Vault](/_astro/hero.B4H3tk7I_1BuPOM.webp)](/codesnippets/post/hashicorp-vault-multi-environment-secrets)

## [Multi-Environment Secret Management with HashiCorp Vault](/codesnippets/post/hashicorp-vault-multi-environment-secrets)

-   [Security](/codesnippets/categories/security)
-   [Devops](/codesnippets/categories/devops)
-   03 Mar 2026
-   04 Mins read

Managing secrets safely across multiple environments with HashiCorp Vault Storing secrets in .env files, hardcoding them, or even using separate secret managers per environment creates security

[#Vault](/codesnippets/tags/vault)[#SecretsManagement](/codesnippets/tags/secretsmanagement)[#MultiEnvironment](/codesnippets/tags/multienvironment)+3 tags

[Bash and Python](/codesnippets/bash-and-python)

[View Code](/codesnippets/post/hashicorp-vault-multi-environment-secrets)

[![Why printf Beats echo in Linux Scripts](/_astro/hero.Dl3YkIwZ_Z1w9hux.webp)](/codesnippets/post/printf-beats-echo-linux-scripts)

## [Why printf Beats echo in Linux Scripts](/codesnippets/post/printf-beats-echo-linux-scripts)

-   [Shell scripting](/codesnippets/categories/shell-scripting)
-   [Devops](/codesnippets/categories/devops)
-   02 Jan 2026
-   03 Mins read

Scripting Tip A script that works on your machine can produce different output on another system. The output command is often the reason. printf behaves the same way across shells, and echo d

[#Bash](/codesnippets/tags/bash)[#Shell Scripting](/codesnippets/tags/shell-scripting)[#Printf](/codesnippets/tags/printf)+5 tags

[Bash](/codesnippets/bash)

[View Code](/codesnippets/post/printf-beats-echo-linux-scripts)

[![Essential Bash Variables for Every Script](/_astro/hero.B4bDowyY_YQpD7.webp)](/codesnippets/post/essential-bash-variables)

## [Essential Bash Variables for Every Script](/codesnippets/post/essential-bash-variables)

-   [Shell scripting](/codesnippets/categories/shell-scripting)
-   [Devops](/codesnippets/categories/devops)
-   26 Dec 2025
-   08 Mins read

Overview Quick Tip You know what's worse than writing scripts? Writing scripts that break every time you move them to a different machine. Built-in Bash variables fix that. The problem wi

[#Bash](/codesnippets/tags/bash)[#Shell Scripting](/codesnippets/tags/shell-scripting)[#Linux](/codesnippets/tags/linux)+4 tags

[Bash](/codesnippets/bash)

[View Code](/codesnippets/post/essential-bash-variables)

[![List S3 Buckets](/_astro/hero.BsiJ6hry_1X9XLn.webp)](/codesnippets/post/python-list-s3-buckets)

## [List S3 Buckets](/codesnippets/post/python-list-s3-buckets)

-   [Aws](/codesnippets/categories/aws)
-   [Python](/codesnippets/categories/python)
-   25 Jun 2025
-   02 Mins read

Overview Multi-profile S3 management Ever juggled multiple AWS accounts and needed a quick S3 bucket inventory across all of them? This Python script handles it. Use case Perfect for or

[#Python](/codesnippets/tags/python)[#Boto3](/codesnippets/tags/boto3)[#AWS](/codesnippets/tags/aws)+5 tags

[Python](/codesnippets/python)

[View Code](/codesnippets/post/python-list-s3-buckets)

[![AWS Secrets Manager](/_astro/hero.BIDl4oI2_Z1yJEXf.webp)](/codesnippets/post/nodejs-aws-secrets-manager)

## [AWS Secrets Manager](/codesnippets/post/nodejs-aws-secrets-manager)

-   [Aws](/codesnippets/categories/aws)
-   [Devops](/codesnippets/categories/devops)
-   18 Jun 2025
-   03 Mins read

Loading secrets in a Node.js app without exposing them If you're still storing API keys or database credentials in .env files or hardcoding them into your codebase, it's time for a better appro

[#NodeJS](/codesnippets/tags/nodejs)[#TypeScript](/codesnippets/tags/typescript)[#AWS](/codesnippets/tags/aws)+3 tags

[Typescript](/codesnippets/typescript)

[View Code](/codesnippets/post/nodejs-aws-secrets-manager)

[![Check S3 Bucket Existence](/_astro/hero.CWiO4GWV_1YUYTb.webp)](/codesnippets/post/bash-s3-bucket-exists)

## [Check S3 Bucket Existence](/codesnippets/post/bash-s3-bucket-exists)

-   [Aws](/codesnippets/categories/aws)
-   [Shell scripting](/codesnippets/categories/shell-scripting)
-   11 Jun 2025
-   02 Mins read

Quick Tip Don't let your deployment blow up because of a missing S3 bucket. This Bash script lets you check if a bucket exists before anything fails. The Problem Missing bucket failure

[#Bash](/codesnippets/tags/bash)[#AWS](/codesnippets/tags/aws)[#DevOps](/codesnippets/tags/devops)+3 tags

[Bash](/codesnippets/bash)

[View Code](/codesnippets/post/bash-s3-bucket-exists)
