IAM
Identity and Access Management
Last updated
Was this helpful?
Identity and Access Management
Last updated
Was this helpful?
Use AWS SSO for internal user management and Cognito for external.
Resource-based policies control access TO your resource, while roles control access FROM your resource to other services.
AWS IAM (Identity and Access Management) provides several types of identities to manage access to AWS resources:
IAM Users:
Individual identities within your AWS account
Have long-term credentials (username/password or access keys)
Ideal for specific individuals needing AWS access
IAM Groups:
Collections of IAM users
Used to manage permissions for multiple users at once
Users can belong to multiple groups
IAM Roles:
Temporary identities with specific permissions
Can be assumed by users, applications, or AWS services
Don't have long-term credentials associated with them
There is no need to rotate credentials
Federated Users:
Users managed outside of AWS (e.g., corporate directory)
Gain temporary access to AWS through federation
Often use SAML 2.0 or custom identity broker
Root User:
Has complete access to all AWS services and resources
Created when you first set up your AWS account
Should be secured and used sparingly
Service-linked Roles:
Predefined roles linked to specific AWS services
Have permissions required for the service to interact with other AWS resources.
Create IAM Groups and assign your users to groups. Group permissions are assigned using IAM policy documents. Your users will automatically inherit the permissions of the group.
Roles are the preferred option from a security perspective.
Roles avoid hard coding your credentials (access key IDs and secret access key)
policies control a role's persission.
you can update a policy attached to a role, and it will take immediate effect.
attaching and detaching roles to running EC2 instances without having to stop or terminate these instances.
To set up identities from your corporate environment in AWS, you'll typically use AWS Identity and Access Management (IAM) with federation. Here's a concise overview of the process:
Set up an identity provider (IdP) in your corporate environment, such as Active Directory Federation Services (ADFS) or Okta.
Configure AWS IAM to trust your corporate IdP:
In the IAM console, create a SAML identity provider
Upload the IdP's metadata document
Create IAM roles that map to your corporate groups or users
Configure your IdP to send SAML assertions to AWS
Set up AWS Single Sign-On (SSO) for a more streamlined experience
Test the federation to ensure users can access AWS resources
This setup allows your corporate users to access AWS resources using their existing corporate credentials.
IAM Roles for EC2:
IAM roles are designed to be used by AWS services, including EC2 instances.
Roles provide temporary security credentials that are automatically rotated.
This is the AWS-recommended best practice for granting permissions to EC2 instances.
Security:
Using roles eliminates the need to store long-term credentials on the EC2 instances.
This approach is more secure as it doesn't require managing and rotating access keys.
Ease of Management:
Roles can be easily attached to EC2 instances at launch time or to running instances.
Permissions can be modified by updating the role, which immediately affects all instances using that role.
Scalability:
As new EC2 instances are launched, they can automatically assume the role without additional configuration.
IAM Policies:
IAM policies cannot be directly attached to EC2 instances.
Policies define permissions but need to be attached to IAM users, groups, or roles.
IAM group:
IAM groups are for organizing IAM users, not for EC2 instances.
IAM roles:
IAM Roles for EC2:
IAM roles are designed to be used by AWS services, including EC2 instances.
Roles provide temporary security credentials that are automatically rotated.
This is the AWS-recommended best practice for granting permissions to EC2 instances.
Security:
Using roles eliminates the need to store long-term credentials on the EC2 instances.
This approach is more secure as it doesn't require managing and rotating access keys.
Ease of Management:
Roles can be easily attached to EC2 instances at launch time or to running instances.
Permissions can be modified by updating the role, which immediately affects all instances using that role.
Scalability:
As new EC2 instances are launched, they can automatically assume the role without additional configuration.