What is IAM in AWS interview questions and answers?
Common IAM Questions and Answers for an AWS Interview
-
What is IAM in AWS? AWS Identity and Access Management (IAM) is a service that allows you to securely control access to AWS resources. It enables the creation of users, groups, and roles, and manages permissions through policies.
-
What are IAM roles? IAM roles are identities with permissions to perform actions on AWS resources. Unlike users, roles do not have long-term credentials and are assumed temporarily by users or services, such as EC2 instances or Lambda functions.
-
What is the difference between an IAM user and an IAM role? An IAM user is associated with long-term credentials like an access key, while an IAM role is a temporary identity assumed by users or AWS services, using temporary credentials generated by AWS Security Token Service (STS).
-
How are IAM policies structured? IAM policies are written in JSON format and define permissions using key elements: Version, Statement, Effect (Allow or Deny), Action (specific operations), Resource (AWS resources), and Condition (optional restrictions).
-
What are managed policies and inline policies? Managed policies are reusable and can be attached to multiple entities. Inline policies are embedded directly into a single user, group, or role, providing entity-specific permissions.
-
How does AWS IAM handle permissions inheritance? Permissions in IAM are not inherited; they are explicitly defined. For example, if a user belongs to a group, the user gains the group’s permissions. However, permissions from a parent AWS account are not inherited by a linked account.
-
What are IAM groups? Groups in IAM are collections of users. Permissions applied to a group are automatically applied to all its members, simplifying permission management.
-
What are IAM access keys, and when are they used? Access keys are used for programmatic access to AWS resources via the AWS CLI, SDKs, or APIs. They consist of an access key ID and a secret access key.
-
What is the principle of least privilege in IAM? The principle of least privilege dictates granting users, groups, or roles only the permissions necessary to perform their tasks, minimizing potential security risks.
-
What is a policy simulator in IAM? The IAM policy simulator is a tool that helps test and troubleshoot policies to understand the permissions they grant or deny, ensuring they work as intended.
-
What is an IAM identity provider? An IAM identity provider allows AWS to integrate with external identity services, such as SAML-based providers, to enable federated access.
-
How do you enforce multi-factor authentication (MFA) in IAM? MFA can be enforced by attaching an IAM policy that includes a condition requiring MFA. For example, the policy might allow actions only if the "aws:MultiFactorAuthPresent" condition is true.
-
How can you audit IAM users and roles for security? Regularly review IAM credentials, rotate access keys, check for unused accounts, ensure the use of MFA, and use AWS IAM Access Analyzer to identify overly permissive roles and policies.
-
What are service-linked roles in IAM? Service-linked roles are predefined roles used by AWS services to perform actions on behalf of your account. These roles simplify permissions management for AWS service integrations.
-
What is AWS Organizations, and how does it interact with IAM? AWS Organizations allows centralized management of multiple AWS accounts. It works with IAM to apply Service Control Policies (SCPs) that define permission boundaries across the accounts within the organization.
-
What is an IAM trust policy? A trust policy is a policy attached to an IAM role that defines which principals (users, accounts, or services) can assume the role.
-
How do you restrict access to specific IP addresses using IAM? Use a condition element in the policy specifying the "aws:SourceIp" condition key. For example, set a range of allowed IP addresses to restrict access.
-
What are the default permissions for new IAM users? By default, new IAM users have no permissions. You must explicitly assign permissions by attaching policies.
-
What is cross-account access in IAM? Cross-account access allows entities in one AWS account to access resources in another account by using IAM roles and trust policies.
-
How does IAM integrate with AWS KMS? IAM manages access to AWS Key Management Service (KMS) keys through key policies and IAM policies, allowing fine-grained control over who can use and manage encryption keys.
GET YOUR FREE
Coding Questions Catalog