3.2. CLI を使用した AWS へのインスタンスのデプロイ
AWS Web コンソールまたは CLI から、新しい RHEL AI AMI を使用して AWS インスタンスを起動できます。インスタンスを起動するには、どちらのデプロイメント方法でも使用できます。次の手順では、CLI を使用してカスタム AMI で AWS インスタンスを起動する方法を示します。
デプロイメントオプションとして CLI を使用する場合、「前提条件」に示すように、いくつかの設定を作成する必要があります。
前提条件
- RHEL AI AMI を作成している。詳細は、「RHEL AI イメージの AWS AMI への変換」を参照してください。
- AWS コマンドラインツール がインストールされており、aws_access_key_id および aws_secret_access_key で適切に設定されている。
- Virtual Private Cloud (VPC) が設定されている。
- インスタンスのサブネットが作成されている。
- SSH キーペアを作成している。
- AWS にセキュリティーグループを作成している。
手順
さまざまなパラメーターには、変数の ID を収集する必要があります。
イメージ ID にアクセスするには、次のコマンドを実行します。
$ aws ec2 describe-images --owners selfセキュリティーグループ ID にアクセスするには、次のコマンドを実行します。
$ aws ec2 describe-security-groupsサブネット ID にアクセスするには、次のコマンドを実行します。
$ aws ec2 describe-subnets
インスタンスを作成するときに環境変数を設定します。
$ instance_name=rhel-ai-instance $ ami=<ami-id> $ instance_type=<instance-type-size> $ key_name=<key-pair-name> $ security_group=<sg-id> $ disk_size=<size-of-disk>次のコマンドを実行し、変数を使用してインスタンスを作成します。
$ aws ec2 run-instances \ --image-id $ami \ --instance-type $instance_type \ --key-name $key_name \ --security-group-ids $security_group \ --subnet-id $subnet \ --block-device-mappings DeviceName=/dev/sda1,Ebs='{VolumeSize='$disk_size'}' \ --tag-specifications 'ResourceType=instance,Tags=[{Key=Name,Value='$instance_name'}]'
ユーザーアカウント
RHEL AI AMI のデフォルトのユーザーアカウントは cloud-user です。パスワードなしで sudo 経由ですべての権限が与えられています。
検証
Red Hat Enterprise Linux AI ツールが正しくインストールされていることを確認するには、
ilabコマンドを実行する必要があります。$ ilab出力例
$ ilab Usage: ilab [OPTIONS] COMMAND [ARGS]... CLI for interacting with InstructLab. If this is your first time running ilab, it's best to start with `ilab config init` to create the environment. Options: --config PATH Path to a configuration file. [default: /home/<user>/.config/instructlab/config.yaml] -v, --verbose Enable debug logging (repeat for even more verbosity) --version Show the version and exit. --help Show this message and exit. Commands: config Command Group for Interacting with the Config of InstructLab. data Command Group for Interacting with the Data generated by... model Command Group for Interacting with the Models in InstructLab. system Command group for all system-related command calls taxonomy Command Group for Interacting with the Taxonomy of InstructLab. Aliases: chat model chat generate data generate serve model serve train model train
Red Hat Enterprise Linux AI の更新
RHEL AI の最新の z-stream バージョンに更新するには、Red Hat Enterprise Linux AI の更新 ドキュメントの手順に従ってください。