Skip to main content

Command Palette

Search for a command to run...

Linux Administration, AWS AMI, and Shell Scripting Basics for Beginners ๐Ÿš€

Updated
โ€ข4 min read
Linux Administration, AWS AMI, and Shell Scripting Basics for Beginners ๐Ÿš€

Linux and AWS are among the most important technologies in the DevOps world. Understanding concepts like Amazon Machine Images (AMI), EBS Volumes, Nginx deployment, and Shell Scripting can help beginners build a strong foundation in Linux Administration and Cloud Computing.

In this article, we'll explore these concepts step by step with practical examples.

๐Ÿ“Œ What is AMI (Amazon Machine Image)?

An Amazon Machine Image (AMI) is a pre-configured template that contains:

  • Operating System

  • Application Server

  • Installed Software

  • Configurations

AMI allows us to create multiple EC2 instances with the same configuration whenever required.

Why Use AMI?

  • Faster server deployment

  • Backup of configured instances

  • Easy scaling

  • Consistent environments

๐Ÿš€ Creating an AMI from an EC2 Instance

Suppose you have already launched an EC2 instance and deployed a website.

Step 1: Launch an EC2 Instance

Create an EC2 instance using Ubuntu or Amazon Linux.

Step 2: Attach an EBS Volume

Attach a 20GB EBS Volume to the instance.

Verify attached storage:

Check mounted filesystems:

Step 3: Install Nginx

Update packages:

Install Nginx:

Check Nginx status:

Enable Nginx:

Step 4: Deploy a Web Page

Navigate to:

Create or modify:

Add sample HTML content and save.

Step 5: Configure Security Group

Allow HTTP traffic.

Inbound Rule

Type Port Source
HTTP 80 Anywhere (0.0.0.0/0)

Save the rules.

Step 6: Verify Website

Copy the Public IP of the EC2 instance.

Open browser:

You should see the Nginx webpage.

๐Ÿ–ผ๏ธ Creating an AMI

After configuring the server:

Steps:

  1. Select EC2 Instance

  2. Click Actions

  1. Select Image and Templates

  2. Click Create Image

  1. Enter Image Name

  2. Add additional volume if required

  3. Click Create Image

AWS will take some time to generate the AMI.

๐Ÿš€ Launching a New Instance from AMI

1.Open AMIs

2.Select your created AMI

3.Click Launch Instance

4.Choose Key Pair

5.Configure instance details

6.Launch

The new instance will have:

  • Nginx installed

  • Website deployed

  • Attached configurations preserved

    This is useful for backup and scaling purposes.

๐Ÿš Introduction to Shell Scripting

Shell scripting automates repetitive Linux tasks.

A shell script is a text file containing Linux commands.

Create Script

Edit:

Structure of a Shell Script

Give Execute Permission

Run:

๐Ÿ‘ค Creating a User Using Shell Script

๐Ÿ“ Creating Files and Folders Using User Input

Folder Creation

๐Ÿ” Creating Folder and Assigning Permissions

Permission Meaning

Value Permission
7 Read + Write + Execute
6 Read + Write
5 Read + Execute
4 Read Only

๐Ÿ”€ Conditional Statements in Shell Scripting

Conditional statements allow decision-making.

Example

๐ŸŽ“ Grade Calculator Using If-Else

Sample Output

โš™๏ธ Using Functions in Shell Script

Functions improve code reusability.

Example

๐ŸŽฏ Conclusion

Learning Linux Administration and AWS basics is a great starting point for a DevOps career. In this article, we covered:

โœ… AMI Creation and Usage โœ… EBS Volume Attachment and Mounting โœ… Unmounting Volumes Safely โœ… Nginx Installation and Deployment โœ… Security Group Configuration โœ… Shell Scripting Basics โœ… User Creation Automation โœ… File and Folder Management โœ… Conditional Statements โœ… Functions in Shell Scripts

Mastering these fundamentals will help you automate tasks, manage cloud infrastructure, and build scalable environments efficiently.

Happy Learning! ๐Ÿš€๐Ÿงโ˜๏ธ