Dev.to Security πŸ” Cybersecurity πŸ‘ 0 πŸ“– 5 min read

AWS IAM Explained: Understanding Identity and Access Management in AWS

Identity and Access Management (IAM) on AWS Maintaining security is a key concern for cloud computing. Once a company has transitioned its applications and infrastructure to AWS, it needs to effectively manage which peo

Identity and Access Management (IAM) on AWS

Maintaining security is a key concern for cloud computing. Once a company has transitioned its applications and infrastructure to AWS, it needs to effectively manage which people can access, and which actions these people can perform on, AWS related resources.

AWS Identity and Access Management (IAM) is used for this.

IAM can be used to create users, groups and roles and to set up policies so that AWS resource access can be adequately controlled and secured.

In this article we will explore what AWS IAM is and its key elements. We will also examine the working of AWS IAM and consider examples of its implementation.

  1. What is AWS IAM?

AWS Identity and Access Management (IAM) is a security tool which lets you control access to AWS.

You can use it to:

Define who can access AWS,

Identify which AWS services can be accessed by who,

Define what can be done within AWS and

Set out rules for resource access.

Example scenario

Within a company there may be 3 different teams;

Developers – require access to EC2 and S3;

Database Administrators – require access to RDS; and

Security Administrators – who require control of security settings.

Whilst not every person should necessarily have full admin access, IAM can be used to tailor individuals’ access levels to suit their job role.

This increases security and ensures that people only have relevant access.

  1. Key elements of AWS IAM

There are 4 key elements of AWS IAM:

Element Function

IAM User Individuals that need to access AWS

IAM Group A collection of users that share common access rights

IAM Role Temporary access rights and permissions

IAM Policy Access rights and restrictions

IAM Users

Users represent individuals and can be created for people that need to access AWS.

Where appropriate, you can even generate an IAM user for each member of a team working on an AWS based project (for example).

Different users can then also be allocated differing levels of access.

IAM Groups

Groups are useful for simplifying the administration of users’ access rights.

For example, establish a β€˜Developers’ group and add an EC2 policy to it. Users that are members of this group will then automatically inherit these access rights.

This streamlines administration.

IAM Roles

Roles are used to supply temporary access rights to recognised users, applications and AWS services.

Example scenario

An application may be hosted on an Amazon EC2 instance and wish to interact with an Amazon S3 bucket.

Rather than hard-coding AWS access keys into the application, an IAM role can be affixed to the EC2 instance. This will then allow the application to leverage temporary access rights to engage with the relevant S3 resources.

Such an approach is more secure.

IAM Policies

Policies are JSON files that set out access rights.

They include;

Effect – Allow or Deny

Action – Which AWS actions are allowed

Resource – Which AWS resources are impacted by the policy

Condition – Further criteria that must be fulfilled to access resources.

  1. Overview of IAM Policies

We will now analyze a basic policy that permits a user to read objects from a particular S3 bucket.


{

"Version": "2012-10-17",

"Statement": [

{

"Effect": "Allow",

"Action": [

"s3:GetObject"

],

"Resource": "arn:aws:s3:::my-example-bucket/*"

}

]

}

This policy:

Defines the version of the language that is being utilised.

Shows that the specified action is permitted.

Permits a user to read S3 objects.

Identifies which objects within a given S3 bucket are included within the policy.

Note that this policy does not permit a user to have complete access to S3 but simply to read objects within one defined bucket.

  1. How does AWS IAM function?

AWS IAM relies on both authentication and authorization mechanisms.

Authentication confirms your identify.

Authorization identifies what you are permitted to do.

For example;

A developer logs in to AWS.

AWS authenticates them.

IAM identifies which access rights are associated with this person.

The developer seeks to access an EC2 instance.

AWS then ascertains if this is permitted.

It will then either allow or disallow this.

By default, access is disallowed and will only be permitted if a suitable policy exists that allows this. Furthermore, Deny access rights will supersede Allow access rights.

  1. AWS IAM Best Practices

Security is always key for AWS.

Some vital best practice recommendations are;

Best Practice Reason

Apply Principle of Least Privilege Only supply those people and/or applications with the access they actually need

Implement MFA Introduce further authentication verification

Do not utilize the root user Safeguard your highest level identity

Use IAM roles Supply temporary access rights to applications and workloads

Manage credentials Securely handle long term credentials where necessary

Audit access rights Delete unneeded users, roles and policies

Use IAM Access Analyzer Discover and assist with optimization of access rights

As previously noted, Principle of Least Privilege is a key principle.

This entails supplying people and applications with just the access that they require in order to undertake particular functions.

  1. AWS IAM in DevOps

IAM is also significant in DevOps and cloud engineering.

As an example, let us consider a CI/CD pipeline that deploys an application to AWS.

This would typically involve;

A developer uploading code to GitHub.

A CI/CD pipeline initiating the deployment.

The pipeline then authenticates with AWS using an IAM role which has been appropriately set up within an identity federation framework.

Only the relevant deployment access rights are provided via this role.

Finally, the application is deployed to the AWS environment.

Again, IAM is valuable as it enables secure, controlled access to AWS for automated deployment, without needing to utilize long-term AWS credentials.

Such considerations are especially pertinent when engaging with AWS services including, Amazon EC2, Amazon S3, AWS Lambda and AWS Code Pipeline.

  1. Key AWS IAM areas to study

If you are studying for AWS qualifications or aiming to become a Cloud Engineer or DevOps Engineer then you should endeavour to understand the following topics:

  1. IAM Users and Groups
  2. IAM Roles and Trust Policies
  3. Identity Based Policies
  4. Resource Based Policies
  5. Managed and Inline Policies
  6. Least Privilege Access
  7. Multi-Factor Authentication (MFA)
  8. IAM Access Analyzer
  9. Cross Account Access
  10. AWS Security Token Service (STS)
  11. IAM Policy Evaluation

Conclusion

Although AWS IAM can be utilized for generating and defining users’ access rights, it is also a crucial element in the security of AWS infrastructure.

Cloud, DevOps and systems administrators can all benefit from understanding AWS IAM. They can then go on to effectively construct secure cloud environments and control access to key resources.

If you are new to AWS, I would encourage you to utilize practical methods to investigate IAM so that you can practically evaluate and analyze it.

Bear in mind that, within cloud security, it is not so much about allowing people and/or applications to have access, but ensuring that they have the correct access.

What is your view on the most significant AWS IAM best practice for maintaining a secure AWS environment?
Please leave a comment and let me know.

πŸ“° Read the original article on Dev.to Security

Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes β€” full credit and traffic to the original publisher.