Skip to the content.

AWS Identity and Access Management

Identity and Access Management

IAM is used to manage access to AWS services and resources securely through users, groups, and permissions to allow and deny access to AWS resources. Important concepts to know:

To learn more, check out:

Best practices:

IAM User created through AWS CLI or AWS API

By default, a brand new IAM user created using AWS CLI or AWS API has no access keys of any kind.

IAM Roles

Roles are created and assigned to AWS resources. These roles grant resources some permissions to access other AWS resources.

Service Roles

Allows you to apply your own customer-managed or AWS Managed policies.

Service-linked Roles

Pre-configured with a specific set of read-only AWS-managed policies that can only be used by that particular service.

Examples of service-linked roles:

Limited number of cases when Service-linked Roles can be modified

The method that you use to edit a service-linked role depends on the service. Some services might allow you to edit the permissions for a service-linked role from the service console, API, or CLI. However, after you create a service-linked role, you cannot change the name of the role because various entities might reference the role. You can edit the description of any role from the IAM console, API, or CLI.

To learn more, check out: Editing a service-linked role

IAM Policies

An IAM Policy is a document that defines one or more permissions.

Sample IAM Scenario: Conflicting Policies

Scenario: A user is included in multiple IAM group policies:

Solution: The IAM group policy is always aggregated. In this case, if the user does not have permission for one group, but has permission for another group, they will have full access to EC2. Unless there is specific deny policy, the user will be able to access EC2.

To learn more, check out: http://docs.aws.amazon.com/IAM/latest/UserGuide/PoliciesOverview.html

EC2 Instances with IAM Profile

We can designate an IAM role to attach to an EC2 instance when launching the instance, or any time after. Attaching an IAM role to an instance allows us to manage permissions for instances centrally with IAM.

Example screenshot below when manuelly creating EC2 instances in the AWS Management Console:

Cross-Account Access

Cross-Account Access allows you to delegate access to resources across different AWS accounts that you own without needing IAM users in each account.

When using a role for cross-account access, a trust policy must be established between the two accounts. This Role type offers two options:

This access is managed by policies that establish trusting and trusted accounts that explicitly allow a trusted principal to access specific resources. Many services use Roles to allow cross-account access to resources.

To learn more, check out:

AWS Organizations

AWS Organizations is a managed services that allows you to centrally govern you environment as you grow and scale your workloads on AWS.

Service Control Policies

These policies enable customers to centralize how they are using AWS services across multiple accounts.

Policy Evaluation Logic

Process:

  1. User sending the request has to be authenticated as a valid user.
  2. AWS checks the context of the request (e.g. what service, what actions).
  3. AWS performs polcy evaluation to determine the level of access.
  4. AWS provides a result based on the evaluated policies, whether allowed or denied.

Policy Evaluation:

  1. All access are DENIED by default.
  2. Principal is checked if it has ALLOW access.
  3. If a DENY access for the resources is defined, it will override ALLOW access on the resource.

Evaluation order of Policies:

  1. Organizational SCPs
  2. Resource-based Policies
  3. IAM Permission Boundaries
  4. Identity-based Policies

For more details, check out Policy evaluation logic.

Active Directory Federation within AWS

AWS allows federation with your existing Active Directory by enabling your corporate credentials as your AWS sign-in.

ADFS Active Directory Federation Service or ADFS provides the SSO and identity broker in Active Directory.

SAML 2.0 Open standard that enables the exchange of identity information between providers and applications. This also enables the SSO in AWS accounts.

Two-way trust

How it works:

AWS Cognito and Web Identity Federation

Amazon Cognito lets you add user sign-up, sign-in, and access control to your web and mobile apps quickly and easily.

Cognito User Pool Manages user sign-in and sign-out directly or via web identity providers (same as identity broker)

Cognito Identity Pool Enables identity creation for users and authentication with providers

How it works: