AWS - Creating IAM users for programming
Table of Contents
IAM users
- Instead of logging in with root user access, create an IAM user and use the credentials for the IAM user to login to the console or do programming.
- Sign-in URL for IAM users for this account will look like this: https://179412345.signin.aws.amazon.com/console
Creating users
- Login to the root account to create users.
- Create a password for the user and assign
IAMUserChangePassword
policy to the user so that the user can change the password on first login. - Assign the users to groups (create groups separately and use the groups to control access levels like
AmazonS3FullAccess
) based on the need. - Create
access key
for the user.- Download the Access Key ID and Secret Access Key combination.
- The users will have to use these while configuring
aws-cli
in local computers.
- Give it to the user so that they can use the access keys to connect to the account from their computers.
Creating user groups
- Preferably, do not assign default policies to user groups directly. Instead, use custom policies to edit policies and then assign the custom policies to user groups.
- If you want to assign default policies to user groups,
- Create user groups with names like
S3 access group
orSQS access group
and assign policies to these groups. Look atPermissions policies
in IAM.- AmazonS3FullAccess
- Add users from the previous step to these user groups.
- Create user groups with names like
Assigning policies to user groups
- Instead of assigning policies to user groups directly, create custom policies like
policies-for-app1
- And then edit the permissions assigned to this policy.
- e.g.
{ "Version": "2012-10-17", "Statement": [ { "Sid": "VisualEditor0", "Effect": "Allow", "Action": "iam:ListRoles", "Resource": "*" }, { "Effect": "Allow", "Action": [ "cloudformation:DescribeStacks", "cloudformation:DescribeStackEvents", "cloudformation:DescribeStackResource", "cloudformation:DescribeStackResources" ], "Resource": "*" } ] }
- e.g.
- Assign this custom policy to user-groups.