Day 38 : Getting Started with AWS Basics ☁
Welcome to Day 38 of our 90-day journey into the world of cloud computing with Amazon Web Services (AWS). In this article series, we will embark on an exciting exploration of the AWS basics, designed to provide you with the essential knowledge needed to navigate and utilize the vast array of cloud services offered by one of the leading cloud computing providers.
What is AWS?
Amazon Web Services (AWS) is a comprehensive and widely-used cloud computing platform provided by Amazon, the e-commerce giant. Launched in 2006, AWS offers a broad range of cloud services and solutions designed to enable businesses and individuals to access computing power, storage, and other resources over the internet, without the need to invest in and maintain physical hardware and infrastructure
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.
Tasks -
Task 1) 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.
Go to aws and search for IAM in search
In the left corner, you can see Access Management. Go to Users.
Click on Add Users
Click on Add Users.
Step 1: Specify user details
- Provide the username you want.
- Select the checkbox for “Provide user access to the AWS Management Console — optional”.
- Select “I want to create an IAM user”
- Click on Next.
Step 2: Set permissions
- Select “Attach policies directly” in the Permission Options.
- In the Permission Policies search bar, search for EC2 and select “AmazonEC2FullAccess”.
Step 3: Review and create
Review the details and click on “Create User”.
Make it a point to download the .csv file, if you are not accessing the AWS through IAM user immediately.
Click on Return to User’s list.
Let’s log in to AWS as an IAM user. Open in any other browser.
After siging in you will landup to aws homescreen
Go to ec2, Launch New Instance and Review + Create your instance.
Now, Connect to your instance
Note that you can’t connect to the instance using “EC2 Instance Connect” as you have not given the user access to ec2:InstanceConnect. So log in using ssh.
Connect via ssh where the keypair is stored
Let’s install docker and Jenkins in this instance using a shell script.
Create a file named install.sh.
#!/bin/bash
sudo apt update
sudo apt install openjdk-11-jre -y
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-get update
sudo apt-get install jenkins -y
sudo systemctl enable jenkins
sudo systemctl start jenkins
sudo apt-get update
sudo apt-get install docker.io -y
sudo systemctl start docker
Let’s run this script now.
But it will throw you persmission error. To fix it
chmod +x <filename>
It’ll install docker and Jenkins.
Now you have to open 8080 port for Jenkins in Inbound rules.
Lets’ check the status of Docker and Jenkins. Execute following commands to check the status of Docker and Jenkins
sudo systemctl status jenkins
sudo systemctl status docker
Yay!!! You’ve successfully installed Docker and Jenkins through a shell script.
Task 2)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.
Go to AWS Dashboard and Search for IAM service.
Go to Access Management > User Groups > Create Group > User Group Name “Avengers”
Attach permissions policies > Give this user group access to S3 Full Access and EC2 Full Access > Click on Create User Group.
Go to Access Management > Users > Create 3 users named IronMan, CaptainAmerica, and Thor.
Go to User Groups > Open the Group Avengers > In the Users section > Click on Add Users >
Click on ‘Add Users’
Congratulations, You’ve successfully addes 3 users CaptionAmerica, IronMan and Thor to your User Group “Avengers”.