Getting Started with AWS Basics☁

This is Day 38 of #90daysofdevops challenge

Getting Started with AWS Basics☁

Congratulations!!!! You have come so far. Don't let your excuses break your consistency. Let's begin our new Journey with Cloud☁. By this time you have created multiple EC2 instances, if not let's begin the journey:

What is AWS ??

AWS or Amazon Web Services is a comprehensive, evolving cloud computing platform provided by Amazon.com. It offers a variety of infrastructure as a service products including:

  • EC2 (Elastic Compute Cloud) - virtual servers in the cloud

  • S3 (Simple Storage Service) - cloud storage

  • VPC (Virtual Private Cloud) - virtual networking in the cloud

  • RDS (Relational Database Service) - managed relational databases in the cloud

  • Lambda - serverless compute

  • ElastiCache - in-memory cache

  • CloudFront - content delivery network (CDN)

With AWS, you pay only for the cloud resources you actually use. You have no upfront infrastructure costs and you can scale up or down your usage based on your requirements.

Some key benefits of AWS are:

  1. Scalability - The ability to rapidly scale up or down your resources based on demand.

  2. Reliability - AWS has a very high uptime and reliability record due to its multiple availability zones.

  3. Cost Efficiency - You only pay for what you use, so it can be more cost efficient than maintaining your own infrastructure.

  4. Flexibility - AWS offers a wide variety of services and configuration options to meet your needs.

  5. Speed - You can quickly provision new resources as needed in minutes.

Some common use cases for AWS are:

  • Hosting web applications

  • Running big data workloads

  • Scaling e-commerce sites during sales events

  • Serving as a disaster recovery site

In summary, AWS provides a suite of cloud computing services that let you scale and adjust your infrastructure as needed, paying only for the resources you consume. It aims to reduce the cost and complexity of maintaining your own physical hardware and data centres.

What is IAM ??

AWS Identity and Access Management (IAM) is a web service that helps you securely control access to AWS resources. With IAM, you can centrally manage permissions that control which AWS resources users can access. You use IAM to control who is authenticated (signed in) and authorized (has permissions) to use resources.

Get to know IAM more deeply Click Here!!

Task 1: Creating IAM User, Launching EC2 Instance, and Installing Jenkins and Docker via Shell Script

  • Create an IAM user with username of your own wish and grant EC2 Access. Launch your Linux instance through the IAM user that you created now and install jenkins and docker on your machine via single Shell Script.

Step 1: Create IAM User

Log in to your AWS Management Console and search for IAM Service.

Open it and Click on "Users" in the left navigation pane.

Click "Add user."

Enter a username of your choice. Select “Programmatic access” and click “Next”.

Select “Attach existing policies directly” and select the policy “AmazonEC2FullAccess”.

Click “Next” until you reach the end, Review configurations then click “Create user”.

Take note of the username and password, as you will need these to authenticate your IAM user when launching instances.

Note down Account ID for login credentials.

Step 2: Launch EC2 Instance

Log in to the AWS Management Console with the IAM user credentials you just created.

Go to the EC2 service and click on “Launch instance”.

Choose a Linux Ubntu OS.

Select Instance type “t2.micro” Create new key pair and download it. I have used my previously created key pair.

Click on “Launch Instance”.

Select the instance and click on connect. Select the Connect to instance with SSH client and copy the SSH link.

Go to th folder where you downloaded the .pem key pair file

Click on the top directory bar and type cmd in the bar then cmd will start.

In the cmd paste the copied ssh url to connect remote server.

Step 3: Shell Script for Jenkins and Docker Installation

Create a shell script (e.g., install_jenkins_docker.sh) with the following content:

#!/bin/bash

#installing java
sudo apt update
java -version
sudo apt install default-jre
javac -version

#installing jenkins
curl -fsSL https://pkg.jenkins.io/debian-stable/jenkins.io-2023.key | sudo tee \
            /usr/share/keyrings/jenkins-keyring.asc > /dev/null
echo deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc] \
            https://pkg.jenkins.io/debian-stable binary/ | sudo tee \
                /etc/apt/sources.list.d/jenkins.list > /dev/null
sudo apt update
sudo apt install jenkins
sudo systemctl start jenkins.service
sudo systemctl status jenkins

#installing docker
sudo apt-get update
sudo apt-get install docker.io -y
sudo systemctl start docker
sudo systemctl status docker

Step 4: Run the Shell Script

Check docker and Jenkins version

Task 2: Creating an Avengers DevOps Team: IAM Users, Groups, and Policies

In this task you need to prepare a devops team of avengers. Create 3 IAM users of avengers and assign them in devops groups with IAM policy.

Step 1: Create 3 IAM Users\

  1. Log in to your AWS Management Console.

  2. Navigate to the IAM service.

  3. Click on "Users" in the left navigation pane.

  4. Click "Add user."

  5. Enter the usernames for the three IAM users (e.g., ironman, thor, hawkeye).

  6. Select "Programmatic access" and "AWS Management Console access" as access types.

  7. Choose "Autogenerated password" or "Custom password" to set initial passwords.

  8. Uncheck the "User must create a new password at next sign-in" option (if you set a custom password).

  9. Choose "Add user to group" and select the "DevOps" group (which we'll create in the next step).

  10. Review and create the users.

Step 2: Create DevOps Group

  1. In the IAM console, click on "Groups" in the left navigation pane.

  2. Click "Create new group."

  3. Enter a group name (e.g., Avengers).

  4. Click "Next Step."

  5. Search for and attach relevant policies to the group. For DevOps access, you might attach policies like "AmazonEC2FullAccess," "AmazonS3FullAccess," "AmazonRDSFullAccess," etc.

  6. Review and create the group.

Now, each user is associated with a specific DevOps group with the necessary IAM policies. You can add more users by clicking “Add users”.

"Thank you for enjoying my DevOps blog! Your positive response fuels my passion to dive deeper into technology and innovation.

Stay tuned for more captivating DevOps articles, where we'll explore this dynamic field together. Follow me on Hashnode and connect on LinkedIn (https://www.linkedin.com/in/som-shanker-pandey/) for the latest updates and discussions.

Did you find this article valuable?

Support Som Pandey's blog by becoming a sponsor. Any amount is appreciated!