8
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

WindowsでもAmazon Q Developer CLIのエージェントがしたい!!!!

Posted at

ClineやGitHub Copilot、Claude Codeなど、生成AIをソフトウェア開発に活用する奴らが、今、激アツですよね!

そんな中、我らがAWSのAmazon Q Developerも「エージェント」機能が追加されました🎉🎉🎉

Q DeveloperのCLIはもともとあったのですが、今回のアップデートでエージェント機能が追加されました。

なかなかやばい奴なのですが、一点問題がありまして、それはWindows版が提供されていないこと。
Mac版とLinux版はあります。

私は普段Windowsを使っているので、どうにかしてWindowsで動作させる方法はないか考えていたのですが、 コンテナを使えばできる! ということに気が付きまして、早速やってみました。

せっかくなので(?)、コンテナ実行環境にAWS製のFinchを使って検証しました。

Docker DesktopやRancher Desktopでも同様のことはできると思います。finchコマンドをdockerコマンドに読み替えてください

Finchをインストール

インストール手順に従うだけですが、画面キャプチャだけ置いておきます。

image.png

image.png

image.png

image.png

image.png

コンテナイメージを作成する

Dockerfileを作成します。

DebianのベースイメージにAWS CLIとQ Developer CLIをインストールしています。

Dockerfile
FROM debian:bookworm-slim

# Update package lists and install curl in one layer
RUN apt-get update && \
    apt-get install -y curl unzip && \
    curl https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip -o awscliv2.zip && \
    unzip -q awscliv2.zip && \
    ./aws/install && \
    curl --proto '=https' --tlsv1.2 -sSf https://desktop-release.q.us-east-1.amazonaws.com/latest/amazon-q.deb -o amazon-q.deb && \
    apt-get install -y ./amazon-q.deb && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/* amazon-q.deb ./aws awscliv2.zip

# Set the working directory to /app
WORKDIR /app

# Run the application
ENTRYPOINT ["q"]
CMD ["chat"]

FinchのVMを起動します。(すでに起動済みの場合は不要です。)

finch vm start

コンテナイメージをビルドします。

finch build -t qdev .

「qdev」という名前のコンテナイメージが作成できました。

初期設定

いくつか初期設定を行います。

  1. ログイン
  2. (オプション)AWS認証情報の設定

1. ログイン

まずは、ログインする必要があります。以下のコマンドを実行します。

finch run -it --rm `
  -v ${PWD}/app:/app `
  -v ${PWD}/.local:/root/.local `
  -v ${PWD}/.aws:/root/.aws `
  qdev login

マウントしているボリュームの用途は以下のとおりです。

  • /app: Q Developer CLIを起動するディレクトリ。ソースファイルの生成などがWindowsに永続化されるようにマウント
  • /root/.local: Q Developerの設定が保存されるディレクトリ。ログイン情報もここに格納されるため永続化が必要
  • /root/.aws: AWS認証情報。Q Developer CLIでAWSにアクセスしない場合は不要

Amazon Q Developerを無料で利用する場合はUse for Free with Builder IDを選択します。
有償のライセンスがある場合はUse with Pro licenseを選択します。

image.png

認証するためのURLやコードが表示されるので、ブラウザで認証してください。

image.png

これでQ Developer CLIが利用できる状態になりました。

2. (オプション)AWS認証情報の設定

Q Developer CLIでAWSへアクセスさせたい場合はAWSの認証情報をセットする必要があります。--entrypoint bashを指定して、Bashシェルを起動します。

finch run -it --rm `
  -v ${PWD}/app:/app `
  -v ${PWD}/.local:/root/.local `
  -v ${PWD}/.aws:/root/.aws `
  --entrypoint bash `
  qdev

aws configureaws configure ssoを実行し、AWSの認証情報をセットします。

image.png

完了したら、exitでBashシェルを終了します。

Q Developer CLIでエージェント使ってみる

準備ができたのでQ Developer CLIを使ってみましょう。

チャットを起動します。

finch run -it --rm `
  -v ${PWD}/app:/app `
  -v ${PWD}/.local:/root/.local `
  -v ${PWD}/.aws:/root/.aws `
  qdev

DockerfileでCMD ["chat"]を指定しているため、Chatを起動する際は最後のパラメーターは不要です。

image.png

例示されているものを実行してみましょう。(日本語もいけるらしいので、日本語で試します)

オレゴンリージョンにあるS3バケットの一覧を取得してください

image.png

image.png

image.png

優秀ですね!

バージニア北部リージョンにバケットが一つだけある環境で試しました。バケット名も正しく取得したうえで、バケットのリージョンを確認してくれました。

すごい

Gen Uをデプロイさせる。(楽勝)

欲張って、難しい指示を出してみました。

Generative AI Use Cases JP (略称:GenU)という生成AIを活用するためのアプリが以下のリポジトリで公開されています。私のAWS環境にデプロイしてください。 https://github.com/aws-samples/generative-ai-use-cases-jp

動画取ってみました。(1時間超えの超大作です)

動画では/acceptallを指定することで、コマンド実行時の確認(「Y」の入力)をスキップしてます。なんやかんやされますので、真似するときはご注意ください。

ちなみに、時間がかかっているのは、npm ciの部分なので、おそらくWindowsのファイルシステムとVolumeマウントしている関係だと思います。

以下、出力結果を記載します。(賢さがすごいです)

  • git cloneを試みるが、gitコマンドがない
こんにちは!Generative AI Use Cases JP (GenU) をあなたのAWS環境にデプロイしましょう。まずはリポジトリをクローンして内容を確認します。



Execute shell command
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I will run the following shell command:
git clone https://github.com/aws-samples/generative-ai-use-cases-jp.git

Executing `git clone https://github.com/aws-samples/generative-ai-use-cases-jp.git`...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
bash: line 1: git: command not found

🟢 Completed in 0.12s
  • gitをインストール
gitコマンドがインストールされていないようです。まずはgitをインストールしてからリポジトリをクローンしましょう。



Execute shell command
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I will run the following shell command:
apt-get update && apt-get install -y git

Executing `apt-get update && apt-get install -y git`...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Get:1 http://deb.debian.org/debian bookworm InRelease [151 kB]
Get:2 http://deb.debian.org/debian bookworm-updates InRelease [55.4 kB]
Get:3 http://deb.debian.org/debian-security bookworm-security InRelease [48.0 kB]
Get:4 http://deb.debian.org/debian bookworm/main amd64 Packages [8792 kB]
Get:5 http://deb.debian.org/debian bookworm-updates/main amd64 Packages [13.5 kB]
Get:6 http://deb.debian.org/debian-security bookworm-security/main amd64 Packages [246 kB]
Fetched 9306 kB in 2s (3790 kB/s)

...省略...

Setting up git (1:2.39.5-0+deb12u2) ...
Processing triggers for libc-bin (2.36-9+deb12u9) ...

🟢 Completed in 10.445s
  • git cloneを実行。次は成功
Execute shell command
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I will run the following shell command:
git clone https://github.com/aws-samples/generative-ai-use-cases-jp.git

Executing `git clone https://github.com/aws-samples/generative-ai-use-cases-jp.git`...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Cloning into 'generative-ai-use-cases-jp'...
Updating files: 100% (564/564), done.

🟢 Completed in 51.472s
  • とりあえずREADME.mdを読む
Read from filesystem
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Reading file: /app/generative-ai-use-cases-jp/README.md, all lines

Reading from filesystem...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Reading: generative-ai-use-cases-jp/README.md

🟢 Completed in 0.12s
  • cdk.jsonを読む。(このパスにあるとなぜわかった??)
Read from filesystem
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Reading file: /app/generative-ai-use-cases-jp/packages/cdk/cdk.json, all lines

Reading from filesystem...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Reading: generative-ai-use-cases-jp/packages/cdk/cdk.json

🟢 Completed in 0.21s
  • AWS CLIを使ってBedrockのモデル一覧を取得
Use AWS CLI
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Running aws cli command:
Service name: bedrock
Operation name: list-foundation-models
Parameters:
Profile name: default
Region: us-east-1
Label: Check if Bedrock models are enabled

Using AWS CLI...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔

🟢 Completed in 4.594s
  • AWS CLIを使ってBedrockモデルへのアクセスが可能化チェック。しかし、get-model-accessAPIがないのでエラー
Use AWS CLI
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Running aws cli command:
Service name: bedrock
Operation name: get-model-access
Profile name: default
Region: us-east-1
Label: Check model access

Using AWS CLI...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔

🔴 Execution failed after 1.71s:

usage: aws [options] <command> <subcommand> [<subcommand> ...] [parameters]
To see help text, you can run:

  aws help
  aws <command> help
  aws <command> <subcommand> help

aws: error: argument operation: Invalid choice, valid choices are:

batch-delete-evaluation-job              | create-evaluation-job
create-guardrail                         | create-guardrail-version
create-inference-profile                 | create-marketplace-model-endpoint
create-model-copy-job                    | create-model-customization-job
create-model-import-job                  | create-model-invocation-job
create-prompt-router                     | create-provisioned-model-throughput
delete-custom-model                      | delete-guardrail
delete-imported-model                    | delete-inference-profile
delete-marketplace-model-endpoint        | delete-model-invocation-logging-configuration
delete-prompt-router                     | delete-provisioned-model-throughput
deregister-marketplace-model-endpoint    | get-custom-model
get-evaluation-job                       | get-foundation-model
get-guardrail                            | get-imported-model
get-inference-profile                    | get-marketplace-model-endpoint
get-model-copy-job                       | get-model-customization-job
get-model-import-job                     | get-model-invocation-job
get-model-invocation-logging-configuration | get-prompt-router
get-provisioned-model-throughput         | list-custom-models
list-evaluation-jobs                     | list-foundation-models
list-guardrails                          | list-imported-models
list-inference-profiles                  | list-marketplace-model-endpoints
list-model-copy-jobs                     | list-model-customization-jobs
list-model-import-jobs                   | list-model-invocation-jobs
list-prompt-routers                      | list-provisioned-model-throughputs
list-tags-for-resource                   | put-model-invocation-logging-configuration
register-marketplace-model-endpoint      | stop-evaluation-job
stop-model-customization-job             | stop-model-invocation-job
tag-resource                             | untag-resource
update-guardrail                         | update-marketplace-model-endpoint
update-provisioned-model-throughput      | help
  • エラーメッセージから、get-foundation-modelを使うことに気づいた模様。アクセス権限をチェック
Use AWS CLI
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Running aws cli command:
Service name: bedrock
Operation name: get-foundation-model
Parameters:
- modelIdentifier: "us.anthropic.claude-3-5-sonnet-20241022-v2:0"
Profile name: default
Region: us-east-1
Label: Check model access for Claude 3.5 Sonnet

Using AWS CLI...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔

🔴 Execution failed after 1.682s:

An error occurred (ValidationException) when calling the GetFoundationModel operation: The provided model identifier is invalid.
  • Nodeをインストール。(Gitが入ってないような環境だからどうせNodeも入ってないんでしょ感)
Execute shell command
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I will run the following shell command:
apt-get update && apt-get install -y nodejs npm

Executing `apt-get update && apt-get install -y nodejs npm`...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Hit:1 http://deb.debian.org/debian bookworm InRelease
Hit:2 http://deb.debian.org/debian bookworm-updates InRelease
Hit:3 http://deb.debian.org/debian-security bookworm-security InRelease
Reading package lists...

...省略...

🟢 Completed in 89.378s
  • npm ci実行
Execute shell command
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I will run the following shell command:
cd /app/generative-ai-use-cases-jp && npm ci

Executing `cd /app/generative-ai-use-cases-jp && npm ci`...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
npm WARN deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm WARN deprecated rimraf@3.0.2: Rimraf versions prior to v4 are no longer supported
npm WARN deprecated sourcemap-codec@1.4.8: Please use @jridgewell/sourcemap-codec instead
npm WARN deprecated @humanwhocodes/config-array@0.13.0: Use @eslint/config-array instead
npm WARN deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported
npm WARN deprecated @humanwhocodes/object-schema@2.0.3: Use @eslint/object-schema instead
npm WARN deprecated eslint@8.57.1: This version is no longer supported. Please see https://eslint.org/version-support for other options.

added 2328 packages, and audited 2386 packages in 20m

416 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

🟢 Completed in 1200.695s
  • またBedrockのモデルアクセスをチェック。しかし、先ほどと同じ存在しないAPIを呼び出す
Use AWS CLI
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Running aws cli command:
Service name: bedrock-runtime
Operation name: get-model-access
Profile name: default
Region: us-east-1
Label: Check model access

Using AWS CLI...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔

🔴 Execution failed after 0.807s:

usage: aws [options] <command> <subcommand> [<subcommand> ...] [parameters]
To see help text, you can run:

  aws help
  aws <command> help
  aws <command> <subcommand> help

aws: error: argument operation: Invalid choice, valid choices are:

apply-guardrail                          | converse
get-async-invoke                         | invoke-model
list-async-invokes                       | start-async-invoke
help
  • Nova Proへのアクセス可能かチェック
Use AWS CLI
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Running aws cli command:
Service name: bedrock
Operation name: get-foundation-model
Parameters:
- modelIdentifier: "amazon.nova-pro-v1:0"
Profile name: default
Region: us-east-1
Label: Check model access for Nova Pro

Using AWS CLI...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔

🟢 Completed in 1.636s
  • Nova Canvasへのアクセス可能かチェック
Use AWS CLI
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Running aws cli command:
Service name: bedrock
Operation name: get-foundation-model
Parameters:
- modelIdentifier: "amazon.nova-canvas-v1:0"
Profile name: default
Region: us-east-1
Label: Check model access for Nova Canvas

Using AWS CLI...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔

🟢 Completed in 1.556s
  • cdk.jsonを更新。モデルのアクセス権がないものを除外しようとした模様WinMergeでDIFFを取るとこんな感じ(合ってるかわからないですが、賢そう!)

image.png

Write to filesystem
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Path: generative-ai-use-cases-jp/packages/cdk/cdk.json

Replacing:

   1: {
   2:   "app": "npx ts-node --prefer-ts-exts bin/generative-ai-use-cases.ts",
...省略...
 106:   }
 107: }

With:

   1: {
   2:   "app": "npx ts-node --prefer-ts-exts bin/generative-ai-use-cases.ts",
...省略...
 104:   }
 105: }



Writing to filesystem...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Replacing: generative-ai-use-cases-jp/packages/cdk/cdk.json

🟢 Completed in 0.28s
  • cdk:bootstrapを実行
Execute shell command
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I will run the following shell command:
cd /app/generative-ai-use-cases-jp && npm run cdk:bootstrap

Executing `cd /app/generative-ai-use-cases-jp && npm run cdk:bootstrap`...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
npm ERR! Missing script: "cdk:bootstrap"
npm ERR!
npm ERR! To see a list of scripts, run:
npm ERR!   npm run

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2025-03-09T13_41_33_328Z-debug-0.log

🟢 Completed in 0.617s
  • npm runを実行。(多分どんなコマンドがあるかscriptをチェックしてる)
Execute shell command
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I will run the following shell command:
cd /app/generative-ai-use-cases-jp && npm run

Executing `cd /app/generative-ai-use-cases-jp && npm run`...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Lifecycle scripts included in generative-ai-use-cases-jp@3.0.0:
  test
    run-s web:test

available via `npm run-script`:
  lint
    run-s root:lint web:lint cdk:lint
  root:lint
    npx prettier --write .
  web:devw
    source ./setup-env.sh ${npm_config_env} && VITE_APP_VERSION=${npm_package_version} npm -w packages/web run dev
  web:devww
    powershell ./web_devw_win.ps1
  web:dev
    VITE_APP_VERSION=${npm_package_version} npm -w packages/web run dev
  web:build
    VITE_APP_VERSION=${npm_package_version} npm -w packages/web run build --
  web:build:analyze
    VITE_APP_VERSION=${npm_package_version} npm -w packages/web run build -- --mode analyze
  web:lint
    npm -w packages/web run lint
  web:test
    npm -w packages/web run test
  cdk:deploy
    npm -w packages/cdk run cdk deploy -- --all
  cdk:deploy:quick
    npm -w packages/cdk run cdk deploy -- --all --asset-parallelism --asset-prebuild=false --concurrency 3 --method=direct --require-approval never --force
  cdk:deploy:quick:hotswap
    npm -w packages/cdk run cdk deploy -- --all --asset-parallelism --asset-prebuild=false --concurrency 3 --method=direct --require-approval never --force --hotswap
  cdk:destroy
    npm -w packages/cdk run cdk destroy --
  cdk:lint
    npm -w packages/cdk run lint
  cdk:test
    npm -w packages/cdk run test
  cdk:test:update-snapshot
    npm -w packages/cdk run test -- --update-snapshot
  extension:ci
    cd browser-extension && npm ci
  extension:dev
    cd browser-extension && npm run dev
  extension:devw
    source ./setup-env.sh && cd browser-extension && npm run dev
  extension:build
    cd browser-extension && npm run build
  extension:buildw
    source ./setup-env.sh && cd browser-extension && npm run build
  extension:lint
    npx prettier --write browser-extension/. && cd browser-extension && npm run lint
  docs:dev
    mkdocs serve
  docs:build
    mkdocs build
  docs:gh-deploy
    mkdocs gh-deploy --


🟢 Completed in 0.524s
  • npx -w packages/cdk cdk bootstrapを実行。(さっきとちょっと違う)
Execute shell command
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I will run the following shell command:
cd /app/generative-ai-use-cases-jp && npx -w packages/cdk cdk bootstrap

Executing `cd /app/generative-ai-use-cases-jp && npx -w packages/cdk cdk bootstrap`...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
 ⏳  Bootstrapping environment aws://593793049175/us-east-1...
Trusted accounts for deployment: (none)
Trusted accounts for lookup: (none)
Using default execution policy of 'arn:aws:iam::aws:policy/AdministratorAccess'. Pass '--cloudformation-execution-policies' to customize.

...省略...

If you don’t want to see a notice anymore, use "cdk acknowledge <id>". For example, "cdk acknowledge 32775".

🟢 Completed in 175.412s
  • npm run cdk:deploy:quickを実行
Execute shell command
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I will run the following shell command:
cd /app/generative-ai-use-cases-jp && npm run cdk:deploy:quick

Executing `cd /app/generative-ai-use-cases-jp && npm run cdk:deploy:quick`...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔

> generative-ai-use-cases-jp@3.0.0 cdk:deploy:quick
> npm -w packages/cdk run cdk deploy -- --all --asset-parallelism --asset-prebuild=false --concurrency 3 --method=direct --require-approval never --force


> cdk
> cdk deploy --all --asset-parallelism --asset-prebuild=false --concurrency 3 --method=direct --require-approval never --force

Bundling asset GenerativeAiUseCasesStack/API/Predict/Code/Stage...

...省略...

✨  Total time: 2005.61s


NOTICES         (What's this? https://github.com/aws/aws-cdk/wiki/CLI-Notices)

32775   (cli): CLI versions and CDK library versions have diverged

        Overview: Starting in CDK 2.179.0, CLI versions will no longer be in
                  lockstep with CDK library versions. CLI versions will now be
                  released as 2.1000.0 and continue with 2.1001.0, etc.

        Affected versions: cli: >=2.0.0 <=2.1005.0

        More information at: https://github.com/aws/aws-cdk/issues/32775


If you don’t want to see a notice anymore, use "cdk acknowledge <id>". For example, "cdk acknowledge 32775".

🟢 Completed in 2345.547s

CDKでデプロイが完了!!!

  • CloudFormationのOutputをチェックして、Web画面のURLを取得。(気が利く!)
Execute shell command
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I will run the following shell command:
cd /app/generative-ai-use-cases-jp && aws cloudformation describe-stacks --stack-name GenerativeAiUseCasesStack --query 'Stacks[0].Outputs[?OutputKey==`WebUrl`].OutputValue' --output text

Executing `cd /app/generative-ai-use-cases-jp && aws cloudformation describe-stacks --stack-name GenerativeAiUseCasesStack --query 'Stacks[0].Outputs[?OutputKey==`WebUrl`].OutputValue' --output text`...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
https://d2irpl1sqn4s9z.cloudfront.net

🟢 Completed in 3.167s
  • 完了メッセージと共に、使い方まで教えてくれる
Generative AI Use Cases JP (GenU) のデプロイが完了しました!以下にデプロイの詳細と使い方をご案内します。

## デプロイ完了

GenU が正常にAWS環境にデプロイされました。以下のURLからアクセスできます:

アプリケーションURL: https://d2irpl1sqn4s9z.cloudfront.net

## GenUの主な機能

GenUは以下のような生成AIのユースケースを提供しています:

1. チャット - Amazon Bedrock上のLLMとチャット形式で対話
2. 文章生成 - 記事、レポート、メールなどの文章を生成
3. 要約 - 大量の文章を要約し、必要な情報を対話形式で引き出す
4. 執筆 - 文章の改善点を客観的に提案
5. 翻訳 - 多言語での翻訳と、コンテキスト情報の反映
6. Webコンテンツ抽出 - ブログやドキュメントから必要な情報を抽出
7. 画像生成 - テキストや画像を元に新しい画像を生成
8. 映像分析 - 映像の画像フレームとテキストを入力としてLLMに分析を依頼
9. ダイアグラム生成 - テキストベースで図を生成

## 初期設定

1. 上記のURLにアクセスし、新規ユーザー登録を行ってください
2. 登録したメールアドレスに確認コードが送信されますので、それを入力してアカウントを有効化します
3. ログイン後、各種ユースケースを試すことができます

## カスタマイズオプション

GenUは様々なカスタマイズが可能です:

• **RAG機能の追加**: Amazon KendraやKnowledge Baseを使った検索拡張生成が可能
• **エージェント機能**: Web検索エージェントやCode Interpreterエージェントの追加
• **独自ユースケースの作成**: ユースケースビルダー機能で独自のAIアプリケーションを作成可能
• **セキュリティ設定**: SAML認証やIPアドレス制限などのセキュリティ機能

## 注意点

1. デプロイされたGenUは、以下のAmazon Bedrockモデルを使用するように設定されています:
   • amazon.nova-pro-v1:0
   • amazon.nova-lite-v1:0
   • amazon.nova-micro-v1:0
   • amazon.nova-canvas-v1:0(画像生成用)

2. これらのモデルへのアクセス権限が必要です。Amazon Bedrockコンソールでモデルアクセスが有効になっていることを確認してください。

3. 追加のカスタマイズや設定変更が必要な場合は、デプロイオプション https://github.com/aws-samples/generative-ai-use-cases-jp/blob/main/docs/DEPLOY_OPTION.md
のドキュメントを参照してください。

GenUを使って、生成AIの様々なユースケースをお試しください!何か質問があればお気軽にどうぞ。

料金

無料プランでは、チャットが月に50回だそうです。有料プランだと無制限(?)と思います。

これが19ドルって、安い気がしますよね?

8
3
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
8
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?