2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

IAM Identity Centerにユーザーを一括で作成する

Posted at

簡単なスクリプトを作りました。
せっかくなのでOSSにして公開しておきます。

  • 既にusernameが存在している場合は無視されます。

aws-idc-import

概要

このプロジェクトは、AWS IAM Identity Center(旧AWS SSO)を使用して、CSVファイルからユーザーとグループを作成し、ユーザーをグループに追加するスクリプトです。

ファイル構成

  • settings.yml: IAM Identity CenterのIdentity Store IDおよびSSOプロファイル名を設定するための設定ファイル。
  • main.py: メインのスクリプトファイル。ユーザーとグループの作成、ユーザーのグループへの追加を行います。
  • users.csv: ユーザー情報を含むCSVファイル。ユーザー名、氏名、メールアドレス、グループ情報が含まれます。

事前準備 AWS SSO 設定手順

  1. AWS CLIをインストールしていない場合は、インストールします:

    pip install awscli
    
  2. AWS SSOを設定します:

    aws configure sso
    
  3. プロンプトに従って、SSOの設定を完了します。

使い方

  1. settings.ymlファイルを作成し、以下の内容を設定します:

    IDENTITY_STORE_ID: 'your-identity-store-id'
    SSO_PROFILE: 'your-sso-profile'
    
  2. users.csvファイルを作成し、以下の形式でユーザー情報を入力します:

    username,first_name,last_name,email,groups
    johndoe,John,Doe,johndoe@example.com,group1;group2
    
  3. requirements.txtファイルに記載されたパッケージをインストールします:

    pip install -r requirements.txt
    
  4. スクリプトを実行します:

    python main.py
    

注意事項

  • settings.ymlファイルには、適切なIdentity Store IDおよびSSOプロファイル名を設定してください。
  • users.csvファイルには、ユーザー情報を正確に入力してください。
  • AWS CLIが設定されている必要があります。

ライセンス

このプロジェクトはMITライセンスの下で提供されます。

バージョン情報

  • Python: 3.x
  • boto3: 最新バージョン
2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?