

终止支持通知：2025年9月15日， AWS 我们将停止对Amazon Lex V1的支持。2025 年 9 月 15 日之后，您将无法再访问 Amazon Lex V1 控制台或 Amazon Lex V1 资源。如果您使用的是 Amazon Lex V2，请改为参阅 [Amazon Lex V2 指南](https://docs.aws.amazon.com/lexv2/latest/dg/what-is.html)。

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# 步骤 2：发布目的 (AWS CLI)
<a name="gs-cli-publish-intent"></a>

在发布某个目的之前，必须先发布该目的引用的所有槽类型。槽类型必须是编号版本，而不是 `$LATEST` 版本。

首先，更新 `OrderFlowers` 目的以使用您在上一步中发布的 `FlowerTypes` 槽类型版本。然后发布 `OrderFlowers` 目的的新版本。

**注意**  
以下 AWS CLI 示例是针对 Unix、Linux 和 macOS 进行格式化的。对于 Windows，请将 `"\$LATEST"` 更改为 `$LATEST` 并将每行末尾的反斜杠 (\$1) 继续符替换为脱字号 (^)。

**发布目的版本 (AWS CLI)**

1. 在中 AWS CLI，获取 `OrderFlowers` Intent 的`$LATEST`版本并将其保存到文件中：

   ```
   aws lex-models get-intent \
       --region region \
       --name OrderFlowers \
       --intent-version "\$LATEST" > OrderFlowers_V4.json
   ```

1. 在文本编辑器中，打开 **OrderFlowers\$1V4.json**文件。删除 `createdDate`、`lastUpdatedDate` 和 `version` 字段。找到 `FlowerTypes` 槽类型并将版本更改为您在上一步中记录的版本号。下面的 **OrderFlowers\$1V4.json** 文件片段显示了更改的位置：

   ```
           {
               "slotType": "FlowerTypes", 
               "name": "FlowerType", 
               "slotConstraint": "Required", 
               "valueElicitationPrompt": {
                   "maxAttempts": 2, 
                   "messages": [
                       {
                           "content": "What type of flowers?", 
                           "contentType": "PlainText"
                       }
                   ]
               }, 
               "priority": 1, 
               "slotTypeVersion": "version", 
               "sampleUtterances": []
           },
   ```

1. 在中 AWS CLI，保存意图的修订版：

   ```
   aws lex-models put-intent \
       --name OrderFlowers \
       --cli-input-json file://OrderFlowers_V4.json
   ```

1. 获取最新目的修订版的校验和：

   ```
   aws lex-models get-intent \
       --region region \
       --name OrderFlowers \
       --intent-version "\$LATEST" > OrderFlowers_V4a.json
   ```

   以下响应片段显示了目的的校验和。请记下此校验和供下一步使用。

   ```
       "name": "OrderFlowers", 
       "checksum": "checksum", 
       "version": "$LATEST",
   ```

1. 发布新目的版本：

   ```
   aws lex-models create-intent-version \
       --region region \
       --name OrderFlowers \
       --checksum "checksum"
   ```

   以下响应片段显示了新目的版本。请记录版本号以供下一步使用。

   ```
       "name": "OrderFlowers", 
       "checksum": "checksum", 
       "version": "version",
   ```

## 下一个步骤
<a name="gs-cli-publish-3"></a>

[步骤 3：发布自动程序 (AWS CLI)](gs-cli-publish-bot.md)