IAM policies decide which identities may perform actions on AWS resources. Roles provide temporary access, while trust policies, resource policies and permission limits determine how that access is granted.
Users, groups, and policies
IAM controls who can do what in an AWS account. Users are identities for people, groups collect users, and policies hold the permissions. The principle of least privilegeGranting only the permissions needed for the task. decides how much those policies allow.
How it works
- Create identities. AWS prefers roles and IAM Identity Center users with temporary credentials; an IAM user has long-term credentials.
- Collect users with the same job into a group.
- Attach policies to the group, user or role. A policyA document that defines permissions or permission limits for requests. lists allowed or denied actions on resources.
- Start from AWS managed policies, then narrow them into customer managed policies that give only what each job needs.
Exam cues
- If the question says many users need the same permissions, think IAM group, because a group policy gives its permissions to each user in the group.
- If the question says only the permissions needed for a task, think least privilege, because it limits actions on specific resources under specific conditions.
- If the question says a friendly IAM user sign-in URL, think account alias, because it replaces the numeric account ID in the URL.
- If the question says store a server certificate, think AWS Certificate Manager (ACM), because it is preferred; use IAM in Regions ACM does not support.
Remember
- Prefer temporary credentials (roles) over long-term IAM user keys.
- For IAM users with long-term credentials, require MFAAuthentication that uses an additional independent factor beyond the initial sign-in credential., update access keys and remove unused users and credentials.
- An IAM user belongs to one account. Credentials: console password, access keys, both, or none yet when created through the CLI or API.
Trap: AWS managed policies do not always grant least privilege. They cover common use cases and can grant more than a specific task needs.
From the AWS docs (9)
- An IAM user group is a collection of IAM users; policies attached to the group give its permissions to every user in it.
- Least-privilege permissions grant only the permissions required for a task, by defining the actions allowed on specific resources under specific conditions.
- AWS recommends starting with AWS managed policies for common use cases and moving toward least privilege with customer managed policies, because AWS managed policies may grant more than a specific use case needs.
- AWS recommends that human users and workloads use temporary credentials, such as IAM roles, instead of IAM users with long-term passwords and access keys.
- IAM best practices include requiring MFA for IAM users and the root user, updating access keys when long-term credentials are needed, and regularly removing unused users, roles, permissions and credentials.
- An account alias replaces the numeric account ID in the IAM user sign-in URL with an easier name.
- ACM is the preferred place for SSL/TLS server certificates; IAM can also store server certificates, and must be used in Regions that ACM does not support.
- An IAM user is an identity in one AWS account with a name and credentials; you choose a console password, access keys or both, and a user created through the CLI or API starts with no credentials.
- An IAM Action value combines a service namespace and an operation name, such as s3:GetObject; wildcards can match several operations.
IAM roles basics
An IAM role gives temporary permissions to whoever is allowed to assume it, such as an AWS service, an application or a federated user.
How it works
- Create a role with permission policies.
- Say who may assume it, such as EC2 or a federated user.
- The identity assumes the role and gets temporary credentials.
Exam cues
- If the question says give an AWS service or app permissions without stored keys, think an IAM role.
- If the question says employees sign in with a corporate directory, think federationUsing authentication from an external identity system to obtain AWS access..
Remember
- Roles use temporary credentials.
- Federation is preferred over IAM users for people.
Trap: A role is not tied to one person and has no long-term password or keys.
From the AWS docs (5)
- An IAM role is an identity with permissions that anyone or anything allowed can assume, such as a service or application, and it provides temporary credentials instead of long-term keys.
- AWS recommends identity federation with temporary credentials for people, and IAM users with long-term keys only for use cases federation does not support.
- An instance profile is the container that passes an IAM role to an EC2 instance.
- Applications retrieve temporary role credentials from EC2 instance metadata.
- EC2 updates temporary credentials before expiration; SDK instance profile credential providers can retrieve and refresh them.
Flashcards
Nothing to review here right now. Pick other topics or another filter.
·
All 11 cards as a list
Ten developers need the same permissions in AWS. What is the simplest way to manage them in IAM?
Put the developers in an IAM user group and attach the policy to the group. Every user in it gets the permissions.
What does the principle of least privilege mean for IAM permissions?
Grant only the permissions a task needs, on specific resources and under specific conditions.
Do AWS managed policies always give least-privilege permissions?
No. They cover common use cases and may grant more than a specific task needs. Move to customer managed policies for least privilege.
Which IAM best practices apply when a company still needs IAM users with long-term credentials?
Require MFA, update (rotate) their access keys, and regularly remove unused users and credentials.
How can an administrator give the same IAM permissions to several users?
Attach a policy to an IAM user group. Its permissions apply to every user in the group.
What does least privilege mean when granting IAM permissions?
Give only the permissions needed for the task, scoped to the relevant actions, resources and conditions.
Does every IAM user need a console password?
No. An IAM user can have a console password, access keys or both.
A user created through the CLI or API starts with no credentials.
An IAM author needs to recognize an operation such as s3:GetObject and the scope of s3:*. What do these Action values mean?
s3:GetObjectnames a service and an operation.s3:*matches the actions in that service namespace.An application on EC2 needs to read from S3. What is the recommended way to give it permissions?
Attach an IAM role to the instance, so the app gets temporary credentials instead of stored access keys.
Employees already sign in to a corporate identity provider. How should they get access to AWS?
Through identity federation, which gives them temporary credentials by assuming roles, instead of creating IAM users.
An EC2 application needs AWS credentials without storing access keys in its machine image. What should the team attach?
An IAM role through an instance profile. Use an SDK instance profile credential provider to retrieve and refresh temporary credentials.