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 文档中的步骤 操作。