Table of contents
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 stands for Amazon Web Services. It is a comprehensive and widely-used cloud computing platform provided by Amazon.
AWS offers a variety of cloud services, including computing power, storage solutions, databases, machine learning, analytics, and more, enabling individuals and organizations to build and deploy applications, websites etc.
AWS is known for its reliability, scalability, and vast global network of data centres, making it a popular choice for businesses and developers to leverage cloud resources and infrastructure.
What is IAM?
IAM stands for Identity and Access Management. It is a service provided by Amazon Web Services (AWS) that allows users to securely control access to AWS resources. IAM enables you to create and manage user identities, groups, and roles, and define permissions to access AWS services and resources.
Components of IAM
Users: These are individuals with unique credentials who can sign in to the AWS Management Console and access AWS resources.
Groups: Users can be organized into groups, and permissions can be assigned to groups rather than individual users.
Roles: IAM roles are not associated with individual users but can be assumed by trusted entities, such as AWS services or users from another AWS account.
Policies: Policies are documents that define what actions are allowed or denied on AWS resources.
TASK 1
Create an IAM user with the username of your 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.
Steps:
Log into your AWS console and go to the IAM dashboard.
Click on Users and then click on Create User.
Describe the name of your user, check the " create an IAM user ", choose your password and click on Next.
Choose "programmatic access" for the access type.
Click on "Create User and your first user will be created.
Using the IAM user's access credentials, you can use AWS CLI or SDKs to launch an EC2 instance programmatically.
aws ec2 run-instances --image-id <your-ami-id> --instance-type <instance-type> --key-name <your-key-pair> --security-group-ids <security-group-id> --subnet-id <subnet-id> --iam-instance-profile Name=<your-iam-instance-profile>
Replace each and everything with your actual data.
Connect your instance via SSH, as you know how to do it.
Create a bash file for writing the script to install Jenkins and docker, Here's the bash file for it
#package.sh #!/bin/bash #to install docker sudo apt-get update sudo apt install docker.io sudo user -aG docker $USER sudo reboot #to install Java for Jenkins sudo apt-get update sudo apt install fontconfig openjdk-17-jre #to install Jenkins curl -fsSL https://pkg.jenkins.io/debian/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 binary/ | sudo tee \ /etc/apt/sources.list.d/jenkins.list > /dev/null sudo apt-get update sudo apt-get install jenkins sudo usermod -aG docker jenkins sudo reboot
Save the package.sh file and give permission to the file by using the following command:
#to give permission chmod 700 package.sh
Then run the command by using the following command
#to run the bash file ./package.sh
This command will run the bash file and the packages will be installed automatically
TASK 2
In this task, you need to prepare a DevOps team of Avengers. Create 3 IAM users of Avengers and assign them to DevOps groups with the IAM policy.
Steps:
Go to your AWS console and access the IAM dashboard
Click on User Groups
Click on Create Group
Name the group DevOps Avengers.
Attach the Policies you want to attach to the group and click on Create group
Your group will be created successfully.
Then go to the users, create a new user and add it to your DevOpsAvengers group by giving each user a name and clicking on Next.
Click on Create User as we did in the previous task.
The at the last, provide each user with the IAM access key ID and secret access key.
Ensure they store these credentials securely and do not share them with others.
<Thats all for today. Hope you like it. FOLLOW to join me in the journey of DevOps>