Powershell to create IAM User

 

This Powershell script is to create an IAM user, Add the user to an IAM group, Set the IAM user password with Reset required on login enabled and then Create Access keys for the user.

 

## ## ## ## ## ## ## ## ## ## ## ## ## ## ##
## Create IAM User with keys & password ##
## Attach to IAM group ##
## Ben Prudence - 31/10/2016 ##
## ## ## ## ## ## ## ## ## ## ## ## ## ## ##

## Import AWS Module
Import-Module AWSPowerShell

## Variabled
$Username = Read-Host "New AWS UserName"
$Password = Read-Host "New AWS User Password" -AsSecureString
$Group = Read-host "AWS IAM Group Name for User to be added to"

## Create User and add to group
New-IAMUser -UserName $Username
Add-IAMUserToGroup -UserName $Username -GroupName $Group

## Set New User Password
New-IAMLoginProfile -UserName $Username -Password $Password -PasswordResetRequired:$true

## Create Access keys for new user
New-IAMAccessKey -UserName $Username

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.