<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>Coder Legion - Recent posts tagged shell-scripting</title>
<link>https://coderlegion.com/tag/shell-scripting</link>
<description>Powered by Question2Answer</description>
<item>
<title>From Shell Scripts to Scalable Automation: Why Ansible?</title>
<link>https://coderlegion.com/24293/from-shell-scripts-to-scalable-automation-why-ansible</link>
<description>&lt;p&gt;Most of us start our automation journey with 𝗦𝗵𝗲𝗹𝗹 𝗦𝗰𝗿𝗶𝗽𝘁𝗶𝗻𝗴—and that's exactly how it should be.&lt;/p&gt;
&lt;p&gt;It's simple, powerful, and a great way to automate repetitive tasks.&lt;/p&gt;
&lt;p&gt;But as your infrastructure grows, you'll eventually hit its limits.&lt;/p&gt;
&lt;p&gt;🚨 Imagine this...&lt;br&gt;
You need to configure 100 or even 1,000 servers.&lt;br&gt;
Yes, you can SSH into each server and execute a shell script.&lt;br&gt;
But managing automation at this scale becomes challenging.&lt;/p&gt;
&lt;p&gt;⚠️ Challenges with Shell Scripting&lt;br&gt;
❌ No Idempotency — Running the same script multiple times can repeat tasks and cause errors unless you add custom checks.&lt;/p&gt;
&lt;p&gt;❌ Limited Error Handling — You must manually validate exit codes ($?) and handle failures yourself.&lt;/p&gt;
&lt;p&gt;❌ Complex at Scale — Large scripts quickly become difficult to maintain with retries, logging, validations, and conditions.&lt;/p&gt;
&lt;p&gt;❌ Limited Scalability — Shell executes sequentially by default. Parallel execution is possible using &amp;amp; and wait, but managing jobs, failures, and thousands of SSH connections adds complexity.&lt;/p&gt;
&lt;p&gt;❌ No Built-in Inventory — You manage server IPs and SSH logic yourself.&lt;/p&gt;
&lt;p&gt;❌ Distribution-Specific Logic — Different Linux distributions often require different commands.&lt;/p&gt;
&lt;p&gt;✅ So, why Ansible?&lt;/p&gt;
&lt;p&gt;Ansible is an open-source, agentless automation tool that follows a push-based architecture.&lt;/p&gt;
&lt;p&gt;It connects to remote servers over SSH, pushes tasks from the control node, and executes them without installing any agent on the managed nodes.&lt;/p&gt;
&lt;p&gt;Key Advantages&lt;br&gt;
✅ Idempotent by default&lt;/p&gt;
&lt;p&gt;✅ Inventory Management&lt;/p&gt;
&lt;p&gt;✅ Parallel Execution&lt;/p&gt;
&lt;p&gt;✅ Better Error Handling&lt;/p&gt;
&lt;p&gt;✅ Configuration Management&lt;/p&gt;
&lt;p&gt;✅ Rich Modules&lt;/p&gt;
&lt;p&gt;✅ Readable &amp;amp; Scalable YAML Playbooks&lt;/p&gt;
&lt;p&gt;💡 Shell Scripting is still a fundamental skill for every DevOps engineer.&lt;/p&gt;
&lt;p&gt;But as your infrastructure grows, writing more shell code isn't always the answer.&lt;/p&gt;
&lt;p&gt;Sometimes, choosing the right tool is.&lt;/p&gt;
&lt;p&gt;The question isn't whether Shell Scripting is good or bad.&lt;/p&gt;
&lt;p&gt;The real question is: At what point does your automation stop scaling?&lt;/p&gt;
&lt;p&gt;Follow my profile for more practical DevOps content and real-world automation insights. 🚀&lt;/p&gt;
</description>
<category>Articles</category>
<guid isPermaLink="true">https://coderlegion.com/24293/from-shell-scripts-to-scalable-automation-why-ansible</guid>
<pubDate>Sat, 08 Aug 2026 17:40:13 +0000</pubDate>
</item>
<item>
<title>From Shell Scripts to Scalable Automation: Why Ansible?</title>
<link>https://coderlegion.com/24294/from-shell-scripts-to-scalable-automation-why-ansible</link>
<description>&lt;p&gt;Most of us start our automation journey with 𝗦𝗵𝗲𝗹𝗹 𝗦𝗰𝗿𝗶𝗽𝘁𝗶𝗻𝗴—and that's exactly how it should be.&lt;/p&gt;
&lt;p&gt;It's simple, powerful, and a great way to automate repetitive tasks.&lt;/p&gt;
&lt;p&gt;But as your infrastructure grows, you'll eventually hit its limits.&lt;/p&gt;
&lt;p&gt;🚨 Imagine this...&lt;br&gt;
You need to configure 100 or even 1,000 servers.&lt;br&gt;
Yes, you can SSH into each server and execute a shell script.&lt;br&gt;
But managing automation at this scale becomes challenging.&lt;/p&gt;
&lt;p&gt;⚠️ Challenges with Shell Scripting&lt;br&gt;
❌ No Idempotency — Running the same script multiple times can repeat tasks and cause errors unless you add custom checks.&lt;/p&gt;
&lt;p&gt;❌ Limited Error Handling — You must manually validate exit codes ($?) and handle failures yourself.&lt;/p&gt;
&lt;p&gt;❌ Complex at Scale — Large scripts quickly become difficult to maintain with retries, logging, validations, and conditions.&lt;/p&gt;
&lt;p&gt;❌ Limited Scalability — Shell executes sequentially by default. Parallel execution is possible using &amp;amp; and wait, but managing jobs, failures, and thousands of SSH connections adds complexity.&lt;/p&gt;
&lt;p&gt;❌ No Built-in Inventory — You manage server IPs and SSH logic yourself.&lt;/p&gt;
&lt;p&gt;❌ Distribution-Specific Logic — Different Linux distributions often require different commands.&lt;/p&gt;
&lt;p&gt;✅ So, why Ansible?&lt;/p&gt;
&lt;p&gt;Ansible is an open-source, agentless automation tool that follows a push-based architecture.&lt;/p&gt;
&lt;p&gt;It connects to remote servers over SSH, pushes tasks from the control node, and executes them without installing any agent on the managed nodes.&lt;/p&gt;
&lt;p&gt;Key Advantages&lt;br&gt;
✅ Idempotent by default&lt;/p&gt;
&lt;p&gt;✅ Inventory Management&lt;/p&gt;
&lt;p&gt;✅ Parallel Execution&lt;/p&gt;
&lt;p&gt;✅ Better Error Handling&lt;/p&gt;
&lt;p&gt;✅ Configuration Management&lt;/p&gt;
&lt;p&gt;✅ Rich Modules&lt;/p&gt;
&lt;p&gt;✅ Readable &amp;amp; Scalable YAML Playbooks&lt;/p&gt;
&lt;p&gt;💡 Shell Scripting is still a fundamental skill for every DevOps engineer.&lt;/p&gt;
&lt;p&gt;But as your infrastructure grows, writing more shell code isn't always the answer.&lt;/p&gt;
&lt;p&gt;Sometimes, choosing the right tool is.&lt;/p&gt;
&lt;p&gt;The question isn't whether Shell Scripting is good or bad.&lt;/p&gt;
&lt;p&gt;The real question is: At what point does your automation stop scaling?&lt;/p&gt;
&lt;p&gt;Follow my profile for more practical DevOps content and real-world automation insights. 🚀&lt;/p&gt;
</description>
<category>Articles</category>
<guid isPermaLink="true">https://coderlegion.com/24294/from-shell-scripts-to-scalable-automation-why-ansible</guid>
<pubDate>Sat, 08 Aug 2026 17:39:49 +0000</pubDate>
</item>
<item>
<title>Deploying a Microservices E-Commerce Application on AWS Using Shell Scripting</title>
<link>https://coderlegion.com/24086/deploying-a-microservices-e-commerce-application-on-aws-using-shell-scripting</link>
<description>&lt;p&gt;&lt;strong&gt;This article was originally published on Hashnode and is being republished here.&lt;/strong&gt; &lt;/p&gt;
&lt;p&gt;It covers deploying a microservices-based e-commerce application on AWS using Shell Scripting, including server setup, service configuration, and application deployment.&lt;/p&gt;
&lt;p&gt;Over the past few days, I learned Shell Scripting and decided to apply everything I had learned by building a complete project from scratch to gain real hands-on experience.&lt;/p&gt;
&lt;p&gt;My goal wasn't just to deploy the RoboShop e-commerce application on AWS using Shell Scripting. I also wanted to understand what happens behind the scenes—how services start, how they communicate with each other, how to automate repetitive deployment tasks, and most importantly, how to troubleshoot issues when things go wrong.&lt;/p&gt;
&lt;p&gt;Throughout this project, I learned how to debug deployment issues by analyzing HTTP status codes, checking Nginx logs, application logs, and database logs, identifying whether the problem was in the upstream or downstream service, and writing proper deployment logs to make troubleshooting easier.&lt;/p&gt;
&lt;p&gt;More than the automation itself, the debugging experience gave me strong hands-on knowledge of application deployment, troubleshooting, and real-world infrastructure automation.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;&lt;strong&gt;What is the RoboShop E-Commerce Project?&lt;/strong&gt;&lt;br&gt;
RoboShop is a microservices-based e-commerce application consisting of around 10 services, including Frontend, Catalogue, User, Cart, Shipping, Payment, MongoDB, MySQL, Redis, RabbitMQ, and Dispatch. Each service has its own responsibility and communicates with other services to complete the order flow.&lt;/p&gt;
&lt;p&gt;This project is a great way to understand how multiple services are deployed, connected, and managed in a real-world environment.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;&lt;strong&gt;Application Components&lt;/strong&gt;&lt;br&gt;
The RoboShop application is built using multiple technologies, with each service having a specific responsibility.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Service&lt;/strong&gt; and       &lt;strong&gt;Technology&lt;/strong&gt;&lt;br&gt;
Mongodb      (NoSQL Database)&lt;br&gt;
Catalogue      (Node.js)&lt;br&gt;
Redis              (Caching Server)&lt;br&gt;
User              (Node.js)&lt;br&gt;
Cart              (Node.js)&lt;br&gt;
Mysql              (SQL Database)&lt;br&gt;
Shipping      (Java)&lt;br&gt;
Rabbitmq      (Message Broker)&lt;br&gt;
Payment      (Python)&lt;br&gt;
Dispatch      (Go (Golang))&lt;br&gt;
Frontend      (Nginx (Reverse Proxy))&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;&lt;strong&gt;How Requests Flow&lt;/strong&gt;&lt;br&gt;
The Frontend uses Nginx as a reverse proxy. Instead of clients communicating directly with backend services, every request first reaches Nginx. Based on the requested URL, Nginx forwards the request to the appropriate backend service.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;location /api/catalogue/ {
    proxy_pass http://catalogue:8080/;
}

location /api/user/ {
    proxy_pass http://user:8080/;
}

location /api/cart/ {
    proxy_pass http://cart:8080/;
}

location /api/shipping/ {
    proxy_pass http://shipping:8080/;
}

location /api/payment/ {
    proxy_pass http://payment:8080/;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Using a reverse proxy provides several benefits:&lt;/p&gt;
&lt;p&gt;Clients communicate only with Nginx, not directly with backend services.&lt;/p&gt;
&lt;p&gt;The actual backend server details remain hidden.&lt;/p&gt;
&lt;p&gt;Nginx routes requests to the correct service based on the URL.&lt;/p&gt;
&lt;p&gt;It also makes it easier to manage load balancing, SSL termination, and routing from a single entry point.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;&lt;strong&gt;Deployment Approach&lt;/strong&gt;&lt;br&gt;
Although the services are built using different technologies such as Node.js, Java, and Python, the deployment process is almost the same for every service.&lt;/p&gt;
&lt;p&gt;The deployment flow includes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Installing the required runtime&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Creating the application user and directory&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Downloading and extracting the application&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Installing application dependencies&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Configuring a systemd service&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Loading the database schema (where required)&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Starting and enabling the service&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Since this workflow was common across almost every service, I moved all the reusable functions into a single common.sh file and reused it across all deployment scripts. This reduced duplicate code and made the scripts much easier to maintain.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;&lt;strong&gt;What I Automated&lt;/strong&gt;&lt;br&gt;
During this project, I automated the following tasks:&lt;/p&gt;
&lt;p&gt;✅ Validated every command using Linux exit codes (0 = Success, non-zero = Failure) to stop execution immediately if a step failed.&lt;/p&gt;
&lt;p&gt;✅ Implemented idempotency, allowing the scripts to be executed multiple times safely.&lt;/p&gt;
&lt;p&gt;✅ Moved all reusable deployment logic into a common common.sh file.&lt;/p&gt;
&lt;p&gt;✅ Automated application deployment for all services, including runtime installation, dependency installation, and systemd configuration.&lt;/p&gt;
&lt;p&gt;✅ Automated EC2 instance creation using AWS CLI.&lt;/p&gt;
&lt;p&gt;✅ Automated Route53 DNS record creation using AWS CLI.&lt;/p&gt;
&lt;p&gt;✅ Generated detailed log files for every deployment step to simplify troubleshooting.&lt;/p&gt;
&lt;p&gt;✅ Performed root user validation before executing privileged operations.&lt;/p&gt;
&lt;p&gt;Instead of repeating the same steps for every server, I automated the entire deployment using Shell Scripting. This made deployments consistent, repeatable, and much faster.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;&lt;strong&gt;Debugging Challenges&lt;/strong&gt;&lt;br&gt;
This was the most interesting part of the project and where I learned the most. Writing the scripts was only one part, Troubleshooting the issues taught me how to debug deployments by following logs and tracing requests step by step instead of guessing.&lt;/p&gt;
&lt;p&gt;After deploying the application, I expected everything to work. However, when I opened the application, the catalogue products were not loading.&lt;/p&gt;
&lt;p&gt;Here's how I approached the issue:&lt;/p&gt;
&lt;p&gt;Checked the browser's HTTP status code and found a 504 Gateway Timeout.&lt;/p&gt;
&lt;p&gt;Looked at the Nginx access.log on the frontend and found that&lt;br&gt;
=&amp;gt; Nginx forwarded the request to the upstream (backend) service.&lt;/p&gt;
&lt;p&gt;=&amp;gt;The upstream service did not return a response within the configured timeout. (waiting for something to get from database)&lt;/p&gt;
&lt;p&gt;Verified that the Catalogue service was running using systemctl status&lt;/p&gt;
&lt;p&gt;Checked the Catalogue service logs using: journalctl -u catalogue -f&lt;/p&gt;
&lt;p&gt;The logs showed that the Catalogue service couldn't connect to MongoDB.&lt;/p&gt;
&lt;p&gt;Logged into the MongoDB server and found that the MongoDB service was stopped.&lt;/p&gt;
&lt;p&gt;Started the MongoDB service, and the Catalogue service immediately began working.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;&lt;strong&gt;💡What I learned:&lt;/strong&gt;&lt;br&gt;
This issue taught me not to jump to conclusions or restart services blindly. Instead, I learned to follow the request flow—from the browser, to Nginx, to the application logs, and finally to the database—to identify the actual root cause.&lt;/p&gt;
&lt;p&gt;This debugging process gave me much more confidence in troubleshooting real deployment issues and understanding how different services interact in a microservices environment.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;&lt;strong&gt;🚀 What's Next?&lt;/strong&gt;&lt;br&gt;
In the next part of this project, I'll automate the application configuration using Ansible, a configuration management tool. This will help eliminate manual server configuration and make deployments even more consistent and scalable.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;&lt;strong&gt;🎉 Final Thoughts&lt;/strong&gt;&lt;br&gt;
This project helped me turn my Shell Scripting knowledge into practical experience. Along the way, I learned a lot by intentionally stopping services, analyzing logs, and troubleshooting the resulting issues.I gained valuable hands-on experience in automation, deployment, and debugging. I'll continue building more projects to strengthen my practical skills and gain even more real-world experience.&lt;/p&gt;
&lt;p&gt;If you're interested in exploring the implementation, feel free to check out the complete project source code from below.&lt;br&gt;
&lt;strong&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/pavankumar0816/shell-roboshop-common&quot;&gt;https://github.com/pavankumar0816/shell-roboshop-common&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;I am including a few screenshots of the deployed application:&lt;br&gt;
&lt;img src=&quot;https://coderlegion.com/?qa=blob&amp;amp;qa_blobid=14644443864324811477&quot; alt=&quot;&quot;&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://coderlegion.com/?qa=blob&amp;amp;qa_blobid=13835948379371085014&quot; alt=&quot;&quot;&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://coderlegion.com/?qa=blob&amp;amp;qa_blobid=1458508592828395889&quot; alt=&quot;&quot;&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://coderlegion.com/?qa=blob&amp;amp;qa_blobid=18310175374989591968&quot; alt=&quot;&quot;&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://coderlegion.com/?qa=blob&amp;amp;qa_blobid=10844257763862837480&quot; alt=&quot;&quot;&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://coderlegion.com/?qa=blob&amp;amp;qa_blobid=9979187544920098741&quot; alt=&quot;&quot;&gt;&lt;/p&gt;
</description>
<category>Articles</category>
<guid isPermaLink="true">https://coderlegion.com/24086/deploying-a-microservices-e-commerce-application-on-aws-using-shell-scripting</guid>
<pubDate>Tue, 04 Aug 2026 10:45:47 +0000</pubDate>
</item>
</channel>
</rss>