Skip to content

Instantly share code, notes, and snippets.

@kasunbg
Created April 3, 2019 07:41
Show Gist options
  • Save kasunbg/1c4b4b956b602e592fcc562bbcfcec5c to your computer and use it in GitHub Desktop.
Save kasunbg/1c4b4b956b602e592fcc562bbcfcec5c to your computer and use it in GitHub Desktop.
Create AWS IAM user via CLI

Usually, you need to run following four commands to create a user.

#!/bin/bash
# create bare user 
aws iam create-user --user-name <user> --tags Key=Creator,Value=kasung

# enable aws console access
aws iam create-login-profile --user-name <user> --password <password> --password-reset-required

# create access keys for programmatic access
aws iam create-access-key --user-name <user>

# add user to a group to provide permissions
aws iam add-user-to-group --group-name <group> --user-name <user>

To find what are the existing groups you have, enter following command:

aws iam list-groups
aws iam list-groups-for-user --user-name <existing-user>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment