Do not use the root user for daily work. The root user has full account-wide access; if those credentials are compromised, an attacker can fully control your account. Use the root account only for initial setup and account-level tasks, and enable MFA.

What IAM manages
IAM lets you manage these core entities:Create an IAM user (console)
To create a user, open the IAM console and choose Users > Add users.
- Give the user a name (for example,
sanjeev). - Enable AWS Management Console access if the user needs to sign in to the console. You can let AWS auto-generate a password or supply one yourself.
- Optionally require the user to create a new password at first sign-in. If you’re creating the user for yourself, you can disable this.

Default permissions for new users
By default, a new IAM user receives no permissions. You must explicitly grant access via group membership, directly attached policies, or inline policies.

Verify permissions (sign in as the IAM user)
When signing in as an IAM user from the console, select “IAM user” on the sign-in page and provide the account ID plus the username and password. You can find the account ID in the root session (top-right account menu). Because the user has no permissions initially, attempts to perform actions — for example creating an S3 bucket — will fail with an error indicating which permission is missing (such ass3:CreateBucket).

Grant permissions to a user
Return to your administrator/root session to modify the user’s permissions. From IAM > Users, open the user, go to the Permissions tab, and click Add permissions. Options include:- Add the user to a group (recommended when multiple users share permissions).
- Copy permissions from an existing user.
- Attach policies directly to the user.
- Create an inline policy for fine-grained control.

AdministratorAccess policy grants full access across the account. Its effective JSON is:
AdministratorAccess to sanjeev. Afterwards, the user can list and create Amazon S3 buckets — confirming the permissions took effect.

Use groups to simplify permission management
If several users need the same permissions, create a group, attach policies to the group, and add users to it. Users inherit all policies attached to any group they belong to, which reduces duplication and simplifies onboarding. Example:- Create group:
Admin - Attach policy:
AdministratorAccess - Add users to
Admin

Monitoring group with the AWS managed ReadOnlyAccess policy. ReadOnlyAccess generally allows Get*, List*, and Describe* actions across services — suitable for users who should only view resources.
If a user with only ReadOnlyAccess attempts to delete an S3 bucket, AWS will deny the request because s3:DeleteBucket is not included in the read-only policy.


Roles — temporary, assumable permissions
Roles provide temporary credentials that a user, AWS service, or an IAM principal in another account can assume. Use roles to:- Grant short-term elevated access without changing a user’s permanent permissions.
- Allow AWS services (EC2, Lambda, etc.) to perform actions on your behalf.
- Enable cross-account access by specifying trusted principals.
- AWS service (for service roles used by EC2, Lambda, etc.), or
- Another AWS account / IAM users within your account.

AmazonS3FullAccess policy:
S3FullAccess) and create it. Creating the role does not automatically allow everyone to assume it — you must explicitly allow specific principals to assume the role.

Allow a user to assume a role (STS AssumeRole)
To allow a specific user (for example,sanjeev) to assume S3FullAccess, attach a policy to that user that permits the sts:AssumeRole action for the role’s ARN. You can create an inline policy on the user:
AssumeS3Access) and attach it to sanjeev. Now sanjeev is authorized to assume the S3FullAccess role — and only that role.

Switch Role (console experience)
To assume the role from the console, copy the role’s Switch Role link (available on the role’s detail page). When the user follows that link, the Switch Role dialog is pre-filled with the account number and role name. The user can choose a display name and color for the role badge and then click Switch Role to assume it.

S3FullAccess, sanjeev can perform S3 operations such as deleting a bucket. After switching back, the user’s original permissions (for example, ReadOnlyAccess) are restored.

Recap
- Use the root account sparingly; create IAM users for everyday tasks.
- New IAM users have no permissions by default.
- Grant permissions by attaching managed or custom policies to users or by adding users to groups.
- Use groups to centrally manage permissions for multiple users.
- Roles provide temporary, assumable permissions for users, services, or cross-account principals. Assumption is controlled via
sts:AssumeRole. - Follow the principle of least privilege: grant only the permissions required to perform a task.
Best practice: follow the principle of least privilege — grant only the permissions required to perform a task, use groups for consistent policy assignment, enable MFA, and prefer roles for temporary elevated access.
Links and references
- AWS IAM documentation: https://docs.aws.amazon.com/iam/
- AssumeRole (STS) API: https://docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRole.html
- Switch Role (console): https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use_switch-role-console.html
- Amazon S3: https://aws.amazon.com/s3/