Python is one of the most sought after programming language when automation is required. The easy to understand syntax, gradual learning curve and a powerful and versatile application makes it the first choice of programmers.
Automation is the creation and application of technologies to produce and deliver services with minimal human intervention. The implementation of automation technologies, techniques and processes improve the efficiency, reliability, and/or speed of many tasks that were previously performed by humans. Python has been the first choice while implementing automation as well as integration of different technologies.
In this blog , I’ve demonstrated a menu driven program which gives the user the privilege of performing various tasks related to Linux operations, Hadoop, AWS, Docker and much more.
Click here to go to the GitHub repository of the project.
In order to run the python script, Python 3 should be pre-installed in your system. If not, then install Python 3 first. In order to perform AWS related operations, we need to install AWS CLI software first.
Note: Some of the commands/operations are exclusively for CentOS/RHEL.
To run the Menu Program, execute the following command in terminal:
The main menu looks like this:
Main menu of the program
You can select from the variety of options available here.
1. General (Linux related) Services:-
Using the above menu, we can perform a variety of tasks ranging from Checking IP address of the machine to Configuration of a Web Server to install/uninstall a package using yum package manager (works on CentOS/RHEL)
The list of available operations are as follows:
- Check the IP address
- Check the Date
- Check the Calendar
- Create a directory
- Create a file
- Configure Web Server
- Launch Firefox
- Add a new user
- Delete a new user
- Ping an IP address
- Install a software
- Uninstall a software
2. Docker Services:-
Using the program, we can perform a series of operations using Docker without typing its commands manually. For those who are unaware, Docker is an open-source Containerization software that creates isolated environments to run an application.
We can perform the following operations in Docker using the menu program:
- Docker Configuration
- Pull a Docker Image
- List all the Containers
- List all the Docker Images
- Remove all Containers
- To launch a Container
- To configure a web server in Docker container
- To launch a GUI application (Firefox) in Docker container
3. Hadoop Services:-
We can use the menu program to perform a list of Hadoop related operations including:
- Configuring the Name Node
- Configuring the Data Node
4. AWS Services:-
We can use the menu program to perform a variety of AWS Services. The menu program works with the help of AWS Command Line Interface program.
The list of operations available in menu program for AWS Services include:
- AWS configuration
- Key Pair Creation
- Security Group Creation
- Launch an EC2 Instance
- Stop an EC2 Instance
- EBS Volume Creation
- Attachment of EBS volume to an EC2 Instance
- Creation of S3 bucket
- Deleting an S3 bucket
The above program enables the user to perform the enlisted operations without knowing the actual syntax/commands used to perform the above operations. This streamlines the process and automates the steps required to achieve the following services.