0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

AWS Identity CenterのユーザーでClineを使う

Posted at

なぜ書いたか

ClineをAWS Bedrockを通して使うとき、AWS Identity Centerのユーザーで認証する方法が見つからなかったので書きます

この記事で書くこと

  • AWS Identity Center のユーザーを使うようにClineを設定する方法

この記事で書かないこと

  • AWS Identity Centerの設定
  • AWS Bedrock 設定(モデルのリクエスト方法)
  • AWS CLIの設定方法
  • VSCodeのインストール方法
  • Clineのインストール方法

バージョン情報

  • Cline: 3.13.3
  • VSCode: 1.99.3
  • AWS CLI: 2.27.1
  • Windows 11 + WSL

(ちなみに)ClineをAWS BedrockとAWS Identity Centerを通してVSCodeで利用するには次の手順を経ます

  • AWSIdentity Centerを有効にして、ユーザーを作成、許可セットを割り当てます
  • AWS Bedrockにて、使用したいモデルが使えるように、リクエスト申請をします
    バージニア北部、オハイオ、オレゴンの各リージョンでリクエストしておくと、クロスリージョン推論がつかえるのでよいかも
  • 自PCにAWS CLIをインストールして、AWS Identity Centerのユーザーで使えるように設定します
    $ aws configure sso などで設定
  • 自PCにVSCodeをインストールして、"拡張機能"からClineをインストールします
  • Clineの設定画面で、AWS CLIの認証情報を使う設定をします(本題)

ClineにてAWS CLIのユーザー情報を利用するように設定

ClineでAWS Bedrockを利用する際のAWSのユーザー情報は、AWS CLIに設定したユーザー情報を利用します
下記の例では [default]や[profile administrator]を使います

$ cat ~/.aws/config
[default]
sso_session = my-sso
sso_account_id = 123456789012
sso_role_name = PowerUserAccess
region = ap-northeast-1
output = yaml

[profile administrator]
sso_session = my-sso
sso_account_id = 123456789012
sso_role_name = AdministratorAccess
region = ap-northeast-1
output = yaml

[sso-session my-sso]
sso_start_url = https://d-xxxxxxxxxx.awsapps.com/start
sso_region = ap-northeast-1
sso_registration_scopes = sso:account:access

Clineの歯車のアイコンから、設定画面を開きます

  • API Provider: Amazon Bedrock
  • ●AWS Profile
  • AWS Profile Name:
    上記の例(~/.aws/config) にて、[default]にしているプロファイルを使うなら空欄にします
    2025-04-29 061426.png

[profile administrator]を使うならadministratorと入力します
2025-04-29 061703.png

  • AWS Region: AWS Bedrockにてモデルのリクエスト申請を行ったリージョンを選択します

  • Use cross-region inference: チェックを付けます

  • Use prompt caching: 項目があればチェックを付けます

  • Model: 使いたいモデルを選択します

  • Enable extended thinking: チェックを付けます

  • Saveボタンをクリックして設定を保存します

使い方

  1. AWS CLIにてユーザー認証を行います
    [default]プロファイルを使う場合
    $ aws sso login
    [profile administrator]プロファイルを使う場合
    $ aws sso login --profile administrator

  2. Clineにてチャットを開始します!

まとめ

Clineの認証にAWSのIAMユーザーを使う方法は見つかるのですが、AWS Identity Centerのユーザーを使う方法が見つからなかったので書いてみました
誰かのお役に立てば幸いです

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?