Day 39 AWS and IAM Basics

Day 39 AWS and IAM Basics

AWS:

Amazon Web Services is one of the most popular Cloud Provider that has free tier too for students and Cloud enthusiasts for their Hands-on while learning

User Data in AWS:

  • When you launch an instance in Amazon EC2, you have the option of passing user data to the instance that can be used to perform common automated configuration tasks and even run scripts after the instance starts. You can pass two types of user data to Amazon EC2: shell scripts and cloud-init directives.
  • You can also pass this data into the launch instance wizard as plain text, as a file (this is useful for launching instances using the command line tools), or as base64-encoded text (for API calls).
  • This will save time and manual effort every time you launch an instance and want to install any application on it like Apache, docker, Jenkins etc

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.

Task1:

Launch EC2 instance with already installed Jenkins on it. Once server shows up in console, hit the IP address in browser and you Jenkins page should be visible.

Take screenshot of Userdata and Jenkins page, this will verify the task completion.

Log in to the AWS Management Console and navigate to the EC2 dashboard.

Click on the "Launch Instance" button to start the process of launching a new EC2 instance.

Choose an Amazon Machine Image (AMI)

No alt text provided for this image

Select an instance type, configure your instance details (such as the number of instances, network settings, and storage),

No alt text provided for this image

Go to advanced details

No alt text provided for this image

In the user data field, enter the following script to install Jenkins and its dependencies:

No alt text provided for this image

Create a security group that allows inbound traffic on port 8080 for Jenkins.

No alt text provided for this image

Copy public-ip address

No alt text provided for this image

Open your web browser and enter the IP address of the instance followed by port number 8080 (e.g., https://<public-ip>:8080). This will take you to the Jenkins login page

No alt text provided for this image


Task2:

Read more on IAM Roles and explain the IAM Users, Groups and Roles in your own terms.

IAM (Identity and Access Management) is an AWS service that allows you to manage users, groups, and roles in your AWS environment. These three components work together to provide granular access control and permissions for your AWS resources.

IAM Users: IAM users are individual AWS accounts that you create for the people or applications that require access to your AWS resources. Each user has a unique set of security credentials, including a user name and password, access keys, and permissions. You can create, modify, and delete users as needed, and grant them specific permissions to access or manage AWS resources.

IAM Groups: IAM groups are collections of IAM users. You can use groups to simplify permissions management, by assigning permissions to a group instead of individual users. For example, you can create a group for developers and assign permissions to access development resources. When you add a user to the group, they automatically inherit the group's permissions.

IAM Roles: IAM roles are another way to manage access to AWS resources. Roles are similar to users, but they are not associated with a specific person or account. Instead, roles are assumed by trusted entities, such as EC2 instances, Lambda functions, or other AWS services. Roles can have permissions policies attached to them, which define the specific permissions that the role is allowed to use.

Create three Roles named: DevOps-User, Test-User and Admin.

Log in to the AWS Management Console and navigate to the IAM dashboard.

Click on "Roles" in the left-hand menu and then click on the "Create role" button.

No alt text provided for this image

Choose the appropriate use case for the role. For example, if you want to create a role for an EC2 instance, choose "AWS service" and then "EC2".

No alt text provided for this image

Select the appropriate permissions policies for the role. You can choose from existing policies or create a custom policy.

No alt text provided for this image

Enter a name for the role and click "Create role".

No alt text provided for this image

Repeat the above steps for each role you want to create: DevOps-User, Test-User, and Admin.

Create a Test-User role

No alt text provided for this image

Create a Admin role

No alt text provided for this image


No alt text provided for this image

Once the roles are created, you can assign them to individual IAM users or groups as needed, and control their access to AWS resources.


Thank you for reading!

要查看或添加评论,请登录

社区洞察

其他会员也浏览了