Automated user migration and management of AWS Identity and Access Management (IAM) resources
In this project based on a real-world scenario, I acted as Cloud Specialist with the mission to migrate users in an automated way and manage AWS IAM (Identity and Access Management) resources.
There were 100 users that needed to be migrated and have MFA (Multi-factor authentication) enabled on their accounts, as this is a security best practice.
To avoid repetitive and manual tasks in the AWS console, I needed to think about automating the processes.
Using shell script and AWS CLI, was very easy to do this task in an automated way.
First I uploaded a .csv file containing all the users to be inserted into the AWS environment.
Then I executed a bash script that read the .csv file and for each line(user) founded, executed IAM commands through the AWS CLI.
Basically 3 commands were executed for each user:
aws iam create-user …
aws iam create-login-profile …
aws iam add-user-to-group …
To learn more about these commands read the official documentation in AWS CLI Command Reference.
The shell script is a powerful scripting language well known in the Linux environment, aligned with the AWS CLI provides powerful interaction with the AWS cloud environment.
After knowing these resources, I think that I will never create users through the AWS console again. The script will be stored here, into the scripts folder. =)