Logo

dev-resources.site

for different kinds of informations.

AWS Resource Listing Script: A DevOps Shell Scripting Project

Published at
12/20/2024
Categories
aws
devops
linux
powerautomate
Author
devopsbysetchuko
Categories
4 categories in total
aws
open
devops
open
linux
open
powerautomate
open
Author
16 person written this
devopsbysetchuko
open
AWS Resource Listing Script: A DevOps Shell Scripting Project

πŸš€ As a beginner in DevOps, I recently completed an insightful shell scripting project following the guidance from @AbhishekVeeramalla's channel. This project has been instrumental in helping me understand both AWS resource management and shell scripting fundamentals. Let me share what I learned and built!

πŸ“‹ Project Overview

The project involves creating a shell script that lists various AWS resources across different services. It's particularly useful for DevOps engineers who need to quickly audit or check resources across their AWS infrastructure.

🎯 What Problem Does It Solve?

In AWS environments, resources can proliferate across different services, making it challenging to maintain visibility. This script provides a quick way to list resources from various AWS services like EC2, S3, RDS, Lambda, and more, all from the command line.

πŸ› οΈ Technical Implementation

βœ… Prerequisites

  • AWS CLI installed and configured
  • Basic understanding of shell scripting
  • AWS account with appropriate permissions

πŸ’» The Script

Here's the complete implementation of our AWS resource listing script:

#!/bin/bash
########################################
# AWS Resource Listing Script
# Author: Setcuko
# Version: v0.0.1
# 
# Supported AWS services:
# - EC2
# - S3
# - DynamoDB
# - Lambda
# - EBS
# - CloudWatch
# - SNS
# - VPC
# - CloudFormation
# - IAM
########################################

# Parameter validation
if [ $# -ne 2 ]; then
    echo "Usage: ./aws_resource_list.sh <aws_region> <aws_service>"
    echo "Example: ./aws_resource_list.sh us-east-1 ec2"
    exit 1
fi

# Assign arguments to variables
aws_region=$1
aws_service=$2

# AWS CLI installation check
if ! command -v aws &> /dev/null; then
    echo "AWS CLI is not installed. Please install the AWS CLI and try again."
    exit 1
fi

# AWS CLI configuration check
if [ ! -d ~/.aws ]; then
    echo "AWS CLI is not configured. Please configure the AWS CLI and try again."
    exit 1
fi

# Main logic for resource listing
case $aws_service in
    ec2)
        echo "Listing EC2 Instances in $aws_region"
        aws ec2 describe-instances --region $aws_region
        ;;
    # ... [other service cases]
esac
Enter fullscreen mode Exit fullscreen mode

⭐ Key Features

  1. Service Support: The script supports multiple AWS services including:
    • πŸ–₯️ EC2 instances
    • πŸͺ£ S3 buckets
    • πŸ“Š DynamoDB tables
    • ⚑ Lambda functions
    • πŸ’Ύ EBS volumes
    • πŸ“ˆ CloudWatch alarms
    • πŸ“± SNS topics
    • 🌐 VPC resources
    • πŸ—οΈ CloudFormation stacks
    • πŸ‘₯ IAM users

We can add further based on our requirement

  1. Input Validation: The script checks for:

    • βœ… Correct number of parameters
    • βœ… AWS CLI installation
    • βœ… AWS CLI configuration
  2. Region-specific: 🌍 Allows checking resources in any AWS region

πŸ”§ Run command

# List EC2 instances in us-east-1
./aws_resource_list.sh us-east-1 ec2
Enter fullscreen mode Exit fullscreen mode

πŸ™ Acknowledgments

Special thanks to @AbhishekVeeramalla for providing such clear and practical guidance through his channel. His DevOps tutorials have been instrumental in helping me understand both the theoretical and practical aspects of AWS and shell scripting.

πŸŽ‰ Conclusion

This project, while seemingly simple, provides a solid foundation in both AWS resource management and shell scripting. It's a practical tool that can be used in real-world scenarios and serves as a great learning exercise for DevOps beginners.

Would love to hear your thoughts and suggestions for improvements! Feel free to comment below or reach out to discuss more DevOps practices. πŸ’‘

powerautomate Article's
30 articles in total
Favicon
Building a Smart Feedback Agent with Copilot Studio, Adaptive cards and Power Automate
Favicon
How to Publish a Power Platform Connector
Favicon
Looking for a mentor who could lead me to a right way for RPA developers
Favicon
How to Shutdown Azure VM
Favicon
The Art of Over Engineering on the Power Platform
Favicon
Invoke an HTTP request without a premium license: connectors summary
Favicon
What is Power Automate: A Complete Guide
Favicon
Get SharePoint library info from Teams context
Favicon
Think You Know Teams Chats? Discover the Workflows
Favicon
AWS Resource Listing Script: A DevOps Shell Scripting Project
Favicon
From Template to Tailored:The Power Platform Way
Favicon
Power Automate vs UiPath: Choosing the right automation tool
Favicon
Hacking Excel Files in Power Automate
Favicon
My Power Platform - Your Year in a Dashboard
Favicon
Power Automate - Handling XML
Favicon
Let's Talk About the Power Platform Dataverse For Teams
Favicon
Securing Plain Text using SHA hashing: SHA-256 Sorcery
Favicon
Mastering Tiered Pricing for Business Growth: A Detailed Guide
Favicon
Dataverse Security Roles
Favicon
Becoming a Power Platform Developer: A Beginner’s Guide
Favicon
Power Platform - Direct to Prod?
Favicon
Power Automate - How to Fix Missing Dependencies
Favicon
Power Automate - Expressions
Favicon
Updating SharePoint items without modifying System columns
Favicon
Power Automate - The Code Review Onion
Favicon
Use Client API Object model in Power Apps
Favicon
Power Up Your SharePoint Embedded Solutions with the Starter Kit
Favicon
Data Source Environment Variables in Power Automate actions
Favicon
Simplify Workflows Using Microsoft Power Automate and Syntex
Favicon
Extract table data from Documents using Azure AI Document Intelligence

Featured ones: