AWS CloudFormation テンプレートを使用して Amazon Lex ボットを管理する |アマゾン ウェブ サービス

AWS CloudFormation テンプレートを使用して Amazon Lex ボットを管理する |アマゾン ウェブ サービス

Amazon Lex は、アプリケーションの会話型インターフェイスを設計、構築、テスト、展開するための高度な自然言語モデルを備えたフルマネージドの人工知能 (AI) サービスです。高度な深層学習テクノロジーを採用してユーザー入力を理解し、開発者が自然言語でユーザーと対話できるチャットボット、仮想アシスタント、その他のアプリケーションを作成できるようにします。

を使用して Amazon Lex ボットを管理する AWS CloudFormation ボットとそれが依存するすべての AWS リソースを定義するテンプレートを作成できます。 AWS CloudFormation は、ユーザーに代わってこれらのリソースを提供および構成し、ボットを新しい環境にデプロイする際の人的エラーのリスクを排除します。 CloudFormation を使用する利点は次のとおりです。

  • 一貫性 – CloudFormation テンプレートは、Amazon Lex ボットに関連付けられたリソースをデプロイおよび管理するための、より一貫性のある自動化された方法を提供します。
  • バージョン管理 – AWS CloudFormation では、Git などのバージョン管理システムを使用して CloudFormation テンプレートを管理できます。これにより、ボットのさまざまなバージョンを維持し、必要に応じて以前のバージョンにロールバックできます。
  • 再利用性 – CloudFormation テンプレートは、開発、ステージング、実稼働などの複数の環境で再利用できます。これにより、異なる環境間で同じボットを定義する時間と労力が節約されます。
  • 拡張性 – Amazon Lex ボットが複雑になるにつれて、 AWSマネジメントコンソール より挑戦的になります。 AWS CloudFormation を使用すると、ボットの定義とリソースを管理するための、より合理的かつ効率的なアプローチが可能になります。
  • オートメーション – CloudFormation テンプレートを使用すると、展開プロセスを自動化できます。次のような AWS のサービスを利用できます。 AWS コードパイプライン および AWS コードビルド Amazon Lex ボットを自動的に構築、テスト、デプロイします。

この投稿では、Amazon Lex V2 ボット用の CloudFormation テンプレートの作成に関連する手順を説明します。

ソリューションの概要

私たちは 旅行を予約する ボットをこの演習の開始点として使用します。 CloudFormation テンプレートを使用して、インテント、スロット、その他の必要なコンポーネントの定義など、新しいボットを最初から作成します。さらに、バージョン管理、エイリアス、統合などのトピックについても検討します。 AWSラムダ 関数、条件分岐の作成、ロギングの有効化など。

前提条件

次の前提条件が必要です。

  • An AWSアカウント CloudFormation テンプレートを作成してデプロイするには
  • 必要な AWS IDおよびアクセス管理 (わたし) パーミッション AWS CloudFormation とテンプレートで使用されるリソースをデプロイするため
  • Amazon Lex、Lambda 関数、および関連サービスの基本的な知識
  • CloudFormation テンプレートの作成とデプロイに関する基本的な知識

IAMロールを作成する

まず、ボットが使用する IAM ロールを作成する必要があります。これを実現するには、CloudFormation テンプレートを初期化し、IAM ロールをリソースとして追加します。次のテンプレートを使用してロールを作成できます。もし、あんたが サンプルテンプレートをダウンロードする それをデプロイすると、IAM ロールが作成されたことが確認できます。この記事ではテンプレートの例を示し、さらに進めていくにつれてそれらをマージしていきます。

AWSTemplateFormatVersion: "2010-09-09"
Transform: AWS::Serverless-2016-10-31
Description: CloudFormation template for book hotel bot.
Resources:
  # 1. IAM role that is used by the bot at runtime
  BotRuntimeRole:    
    Type: AWS::IAM::Role
    Properties:
      AssumeRolePolicyDocument:
        Version: "2012-10-17"
        Statement:
          - Effect: Allow
            Principal:
              Service:
                - lexv2.amazonaws.com
            Action:
              - "sts:AssumeRole"
      Path: "/"
      Policies:
        - PolicyName: LexRuntimeRolePolicy
          PolicyDocument:
            Version: 2012-10-17
            Statement:
              - Effect: Allow
                Action:
                  - "polly:SynthesizeSpeech"
                  - "comprehend:DetectSentiment"
                Resource: "*"

Amazon Lex ボットを設定する

次に、ボット定義を追加する必要があります。以下は、Amazon Lex ボット定義の YAML テンプレートです。必要なコンポーネントを 1 つずつ構築します。

Type: AWS::Lex::Bot
Properties:
  AutoBuildBotLocales: Boolean
  BotFileS3Location: 
    S3Location
  BotLocales: 
    - BotLocale
  BotTags: 
    - Tag
  DataPrivacy: 
    DataPrivacy
  Description: String
  IdleSessionTTLInSeconds: Integer
  Name: String
  RoleArn: String
  TestBotAliasSettings: 
    TestBotAliasSettings
  TestBotAliasTags: 
    - Tag

意図を持たずにボット定義のみを含むボットを作成するには、次のテンプレートを使用できます。ここでは、ボットの名前、以前に作成したロールの ARN、データ プライバシー設定などを指定します。

BookHotelBot:
    DependsOn: BotRuntimeRole # The role created in the previous step
    Type: AWS::Lex::Bot
    Properties:
      Name: "BookHotel"
      Description: "Sample Bot to book a hotel"
      RoleArn: !GetAtt BotRuntimeRole.Arn      
      #For each Amazon Lex bot created with the Amazon Lex Model Building Service, you must specify whether your use of Amazon Lex 
      #is related to a website, program, or other application that is directed or targeted, in whole or in part, to children under 
      #age 13 and subject to the Children's Online Privacy Protection Act (COPPA) by specifying true or false in the 
      #childDirected field.
      DataPrivacy:
        ChildDirected: false
      IdleSessionTTLInSeconds: 300

また、ご購読はいつでも停止することが可能です 更新されたテンプレートをダウンロードする。更新されたテンプレートをデプロイすると、ロールとボット定義の両方を作成できます。注意してください。 スタックの更新 前のステップで作成した。

最後のステップでは、 BotLocales、ボットの機能の大部分を形成します。これには、例えば、 Intents および Slot types。 YAML テンプレートは次のとおりです。

  CustomVocabulary: 
    CustomVocabulary
  Description: String
  Intents: 
    - Intent
  LocaleId: String
  NluConfidenceThreshold: Number
  SlotTypes: 
    - SlotType
  VoiceSettings: 
    VoiceSettings

この場合、ビルドするのは、 BookHotel これには、部屋タイプに応じたカスタム スロット タイプが必要です。あなたが設定したのは、 LocaleId、 そうして VoiceSettings。次に、 SlotTypes とそれに対応する値。

次のステップは、 Intents最初の意図から始めて、 BookHotelこれには、発話、スロット、スロット優先順位の追加が含まれます。これらのノードの詳細は、提供されたテンプレートで説明されています。最後に、2 番目のインテントを追加します。 FallbackIntent。 次のコードを参照してください。

BotLocales:
        - LocaleId: "en_US"
          Description: "en US locale"
          NluConfidenceThreshold: 0.40
          VoiceSettings:
            VoiceId: "Matthew"
          SlotTypes:
            - Name: "RoomTypeValues"
              Description: "Type of room"
              SlotTypeValues:
                - SampleValue:
                    Value: queen
                - SampleValue:
                    Value: king
                - SampleValue:
                    Value: deluxe
              ValueSelectionSetting:
                ResolutionStrategy: ORIGINAL_VALUE
          Intents:
            - Name: "BookHotel"
              Description: "Intent to book a hotel room"
              SampleUtterances:
                - Utterance: "Book a hotel"
                - Utterance: "I want a make hotel reservations"
                - Utterance: "Book a {Nights} night stay in {Location}"
              IntentConfirmationSetting:
                PromptSpecification:
                  MessageGroupsList:
                    - Message:
                        PlainTextMessage:
                          Value: "Okay, I have you down for a {Nights} night stay in {Location} starting {CheckInDate}.  Shall I book the reservation?"
                  MaxRetries: 3
                  AllowInterrupt: false
                DeclinationResponse:
                  MessageGroupsList:
                    - Message:
                        PlainTextMessage:
                          Value: "Okay, I have cancelled your reservation in progress."
                  AllowInterrupt: false
              SlotPriorities:
                - Priority: 1
                  SlotName: Location
                - Priority: 2
                  SlotName: CheckInDate
                - Priority: 3
                  SlotName: Nights
                - Priority: 4
                  SlotName: RoomType
              Slots:
                - Name: "Location"
                  Description: "Location of the city in which the hotel is located"
                  SlotTypeName: "AMAZON.City"
                  ValueElicitationSetting:
                    SlotConstraint: "Required"
                    PromptSpecification:
                      MessageGroupsList:
                        - Message:
                            PlainTextMessage:
                              Value: "What city will you be staying in?"
                      MaxRetries: 2
                      AllowInterrupt: false
                - Name: "CheckInDate"
                  Description: "Date of check-in"
                  SlotTypeName: "AMAZON.Date"
                  ValueElicitationSetting:
                    SlotConstraint: "Required"
                    PromptSpecification:
                      MessageGroupsList:
                        - Message:
                            PlainTextMessage:
                              Value: "What day do you want to check in?"
                      MaxRetries: 2
                      AllowInterrupt: false
                - Name: "Nights"
                  Description: "something"
                  SlotTypeName: "AMAZON.Number"
                  ValueElicitationSetting:
                    SlotConstraint: "Required"
                    PromptSpecification:
                      MessageGroupsList:
                        - Message:
                            PlainTextMessage:
                              Value: "How many nights will you be staying?"
                      MaxRetries: 2
                      AllowInterrupt: false
                - Name: "RoomType"
                  Description: "Enumeration of types of rooms that are offered by a hotel."
                  SlotTypeName: "RoomTypeValues"
                  ValueElicitationSetting:
                    SlotConstraint: "Required"
                    PromptSpecification:
                      MessageGroupsList:
                        - Message:
                            PlainTextMessage:
                              Value: "What type of room would you like, queen, king or deluxe?"
                      MaxRetries: 2
                      AllowInterrupt: false
            - Name: "FallbackIntent"
              Description: "Default intent when no other intent matches"
              ParentIntentSignature: "AMAZON.FallbackIntent"

また、ご購読はいつでも停止することが可能です CloudFormation テンプレートをダウンロードする 今までの仕事に対して。お先にどうぞ スタックを更新する このテンプレートを使用すると、機能的なボットがデプロイされます。 Amazon Lex コンソールで、ボットのドラフトバージョンと、という名前のデフォルトのエイリアスがあることを確認できます。 TestBotAlias 作成されています。

ボットのエイリアス

新しいボットのバージョンとエイリアスを作成する

Amazon Lex はパブリッシングをサポートします バージョン ボット、インテント、スロット タイプを管理して、クライアント アプリケーションの実装を制御できるようにします。バージョンは、開発、ベータ展開、運用など、ワークフローのさまざまな部分で使用するために公開できるボット定義の番号付きスナップショットです。 Amazon Lex ボットもサポート エイリアス。エイリアスは、ボットの特定のバージョンへのポインターです。エイリアスを使用すると、クライアント アプリケーションのバージョンを更新できます。実際のシナリオでは、ボット エイリアスは、ブルー/グリーン デプロイメントと、開発環境や運用環境などの環境固有の構成の管理に使用されます。

説明のために、エイリアスがボットのバージョン 1 を指すとします。ボットを更新する時期が来たら、バージョン 2 を公開し、新しいバージョンを指すようにエイリアスを変更できます。アプリケーションは特定のバージョンではなくエイリアスを使用するため、すべてのクライアントは更新を必要とせずに新しい機能を受け取ります。

CloudFormation テンプレートを変更してデプロイを開始すると、その変更は主にテストを目的としたドラフト バージョン内に実装されることに注意してください。テスト段階が完了したら、新しいバージョンを確立して、これまでに組み込んだ変更を完成させることができます。

次に、ドラフトに基づいて新しいボット バージョンを作成し、新しいエイリアスを設定して、バージョンをこのエイリアスにリンクします。以下は、テンプレートに追加する 2 つの新しいリソースです。

BookHotelInitialVersion:
    DependsOn: BookHotelBot
    Type: AWS::Lex::BotVersion
    Properties:
      BotId: !Ref BookHotelBot
      BotVersionLocaleSpecification:
        - LocaleId: en_US
          BotVersionLocaleDetails:
            SourceBotVersion: DRAFT
      Description: Hotel Bot initial version

  BookHotelDemoAlias:
    Type: AWS::Lex::BotAlias
    Properties:
      BotId: !Ref BookHotelBot
      BotAliasName: "BookHotelDemoAlias"
      BotVersion: !GetAtt BookHotelInitialVersion.BotVersion

また、ご購読はいつでも停止することが可能です 新しいバージョンのテンプレートをダウンロードする スタックを更新してデプロイします。 Amazon Lex コンソールで、新しいバージョンが作成され、という新しいエイリアスに関連付けられていることがわかります。 BookHotelDemoAlias.

デモエイリアス

Amazon Lex ボットの新しいバージョンを作成すると、通常、バージョン番号が 1 から順番に増加します。特定のバージョンを識別するには、その説明を参照してください。

初期バージョン

Lambda関数を追加する

ボットの値を初期化するか、ユーザー入力を検証するには、Lambda 関数をコードフックとしてボットに追加します。同様に、データベースにデータを書き込んだり、API を呼び出して収集した情報を保存したりするなど、フルフィルメントにも Lambda 関数を使用できます。詳細については、以下を参照してください。 AWS Lambda 関数を使用したカスタム ロジックの有効化.

Lambda 関数の新しいリソースを CloudFormation テンプレートに追加しましょう。 CloudFormation テンプレートにコードを埋め込むことは一般的に推奨されませんが、ここではデモのデプロイメントの複雑さを軽減するためだけに埋め込みます。次のコードを参照してください。

HotelBotFunction:
    DependsOn: BotRuntimeRole # So that the Lambda function is ready before the bot deployment
    Type: AWS::Serverless::Function
    Properties:
      FunctionName: book_hotel_lambda
      Runtime: python3.11
      Timeout: 15
      Handler: index.lambda_handler
      InlineCode: |
        import os
        import json

        def close(intent_request):
            intent_request['sessionState']['intent']['state'] = 'Fulfilled'

            message = {"contentType": "PlainText",
                      "content": "Your Booking is confirmed"}

            session_attributes = {}
            sessionState = intent_request['sessionState']
            if 'sessionAttributes' in sessionState:
                session_attributes = sessionState['sessionAttributes']

            requestAttributes = None
            if 'requestAttributes' in intent_request:
                requestAttributes = intent_request['requestAttributes']

            return {
                'sessionState': {
                    'sessionAttributes': session_attributes,
                    'dialogAction': {
                        'type': 'Close'
                    },
                    'intent': intent_request['sessionState']['intent'],
                    'originatingRequestId': 'xxxxxxx-xxxx-xxxx-xxxx'
                },
                'messages':  [message],
                'sessionId': intent_request['sessionId'],
                'requestAttributes': requestAttributes
            }

        def router(event):
            intent_name = event['sessionState']['intent']['name']
            slots = event['sessionState']['intent']['slots']
            if (intent_name == 'BookHotel'):
                # invoke lambda and return result
                return close(event)

            raise Exception(
                'The intent is not supported by Lambda: ' + intent_name)

        def lambda_handler(event, context):
            response = router(event)
            return response

この Lambda 関数をフルフィルメントに使用するには、インテントでコード フック設定を有効にします。

Intents:
  - Name: "BookHotel"
    Description: "Intent to book a hotel room"
    FulfillmentCodeHook:
      Enabled: true
    SampleUtterances:
      - Utterance: "Book a hotel"
      - Utterance: "I want a make hotel reservations"
      - Utterance: "Book a {Nights} night stay in {Location}"

ボットに変更を加えたので、という名前の新しいリソースを追加して、新しいバージョンのボットを作成できます。 BookHotelVersionWithLambda テンプレート内:

BookHotelVersionWithLambda:
    DependsOn: BookHotelInitialVersion
    Type: AWS::Lex::BotVersion
    Properties:
      BotId: !Ref BookHotelBot
      BotVersionLocaleSpecification:
        - LocaleId: en_US
          BotVersionLocaleDetails:
            SourceBotVersion: DRAFT
      Description: Hotel Bot with a lambda function

Lambda 関数はボット エイリアスに関連付けられています。 Amazon Lex V2 は、言語ごとのボットエイリアスごとに XNUMX つの Lambda 関数を使用できます。したがって、Lambda 関数リソースを追加するには、テンプレート内のエイリアスを更新する必要があります。これは、 BotAliasLocalSettings セクション。また、エイリアスが作成した新しいバージョンを指すようにする必要があります。次のコードは、変更されたエイリアス構成です。

  BookHotelDemoAlias:
    Type: AWS::Lex::BotAlias
    Properties:
      BotId: !Ref BookHotelBot
      BotAliasName: "BookHotelDemoAlias"
      BotVersion: !GetAtt BookHotelVersionWithLambda.BotVersion
      # Remove BotAliasLocaleSettings if you aren't concerned with Lambda setup.
      # If you are you can modify the LambdaArn below to get started.
      BotAliasLocaleSettings:
        - LocaleId: en_US
          BotAliasLocaleSetting:
            Enabled: true
            CodeHookSpecification:
              LambdaCodeHook:
                CodeHookInterfaceVersion: "1.0"
                LambdaArn: !GetAtt HotelBotFunction.Arn

これまでは、Lambda 関数をエイリアスにリンクするだけでした。ただし、エイリアスによる Lambda 関数の呼び出しを許可する権限を付与する必要があります。次のコードでは、Amazon Lex の Lambda 呼び出しアクセス許可を追加し、エイリアス ARN をソース ARN として指定します。

  LexInvokeLambdaPermission:
    Type: AWS::Lambda::Permission
    Properties:
      Action: "lambda:InvokeFunction"
      FunctionName: !GetAtt HotelBotFunction.Arn
      Principal: "lexv2.amazonaws.com"
      SourceArn: !GetAtt BookHotelDemoAlias.Arn

また、ご購読はいつでも停止することが可能です 最新バージョンをダウンロードする テンプレートの。このバージョンでスタックを更新すると、Amazon Lex ボットが Lambda 関数と統合されるようになります。

第二版

更新されたアリス

条件分岐

次に、Amazon Lex ボットの条件分岐機能を調べて、来週シアトルで 5 泊以上の予約が許可されないシナリオを考えてみましょう。ビジネス要件に従って、ユーザーがシアトルで 5 泊以上予約しようとすると、会話は適切なメッセージで終了する必要があります。その条件分岐は、CloudFormation テンプレートの SlotCaptureSetting:

- Name: "Nights"
                  Description: “Number of nights.”
                  SlotTypeName: "AMAZON.Number"
                  ValueElicitationSetting:
                    SlotConstraint: "Required"
                    SlotCaptureSetting:
                      CaptureConditional:
                        DefaultBranch:
                          NextStep:
                            DialogAction:
                              Type: "ElicitSlot"
                              SlotToElicit: "RoomType"
                        ConditionalBranches:
                          - Name: "Branch1"
                            Condition:
                              ExpressionString: '{Nights}>5 AND {Location} = "Seattle"'
                            Response:
                              AllowInterrupt: true
                              MessageGroupsList:
                                - Message:
                                    PlainTextMessage:
                                      Value: “Sorry, we cannot book more than five nights in {Location} right now."
                            NextStep:
                              DialogAction:
                                Type: "EndConversation"
                        IsActive: true

                    PromptSpecification:
                      MessageGroupsList:
                        - Message:
                            PlainTextMessage:
                              Value: "How many nights will you be staying?"
                      MaxRetries: 2
                      AllowInterrupt: false

ボット定義を変更したため、テンプレート内に新しいバージョンを作成し、それをエイリアスにリンクする必要があります。同社は間もなくシアトルで大量の予約を許可する予定であるため、これは一時的な変更です。テンプレートに追加する 2 つの新しいリソースは次のとおりです。

BookHotelConditionalBranches:
    DependsOn: BookHotelVersionWithLambda
    Type: AWS::Lex::BotVersion
    Properties:
      BotId: !Ref BookHotelBot
      BotVersionLocaleSpecification:
        - LocaleId: en_US
          BotVersionLocaleDetails:
            SourceBotVersion: DRAFT
      Description: Hotel Bot Version with conditional branches

  BookHotelDemoAlias:
    Type: AWS::Lex::BotAlias
    Properties:
      BotId: !Ref BookHotelBot
      BotAliasName: "BookHotelDemoAlias"
      BotVersion: !GetAtt BookHotelConditionalBranches.BotVersion
      # Remove BotAliasLocaleSettings if you aren't concerned with Lambda setup.
      # If you are you can modify the LambdaArn below to get started.
      BotAliasLocaleSettings:
        - LocaleId: en_US
          BotAliasLocaleSetting:
            Enabled: true
            CodeHookSpecification:
              LambdaCodeHook:
                CodeHookInterfaceVersion: "1.0"
                LambdaArn: !GetAtt HotelBotFunction.Arn

また、ご購読はいつでも停止することが可能です 更新されたテンプレートをダウンロードする。このテンプレート バージョンでスタックを更新すると、エイリアスは条件分岐機能を組み込んだバージョンにリダイレクトされます。この変更を元に戻すには、エイリアスを更新して前のバージョンに戻すことができます。

XNUMX番目のバージョン

3番目のバージョンのエイリアス

ログ

Amazon Lex ボットのログを有効にすることもできます。これを行うには、ボットのロールを更新して書き込み権限を付与する必要があります。 アマゾンクラウドウォッチ ログ。以下は、CloudWatch ポリシーをロールに追加する例です。

BotRuntimeRole:
    Type: AWS::IAM::Role
    Properties:
      AssumeRolePolicyDocument:
        Version: "2012-10-17"
        Statement:
          - Effect: Allow
            Principal:
              Service:
                - lexv2.amazonaws.com
            Action:
              - "sts:AssumeRole"
      Path: "/"
      Policies:
        - PolicyName: LexRuntimeRolePolicy
          PolicyDocument:
            Version: 2012-10-17
            Statement:
              - Effect: Allow
                Action:
                  - "polly:SynthesizeSpeech"
                  - "comprehend:DetectSentiment"
                Resource: "*"
        - PolicyName: CloudWatchPolicy
          PolicyDocument:
            Version: 2012-10-17
            Statement:
              - Effect: Allow
                Action:
                  - "logs:CreateLogStream"
                  - "logs:PutLogEvents"
                Resource: "*"

一貫性のある予測可能な動作を確保するには、CloudFormation テンプレートでリソース名とプロパティを定義するときに、できるだけ具体的にする必要があります。これは、CloudFormation テンプレートでワイルドカード文字 (*) を使用すると、潜在的なセキュリティ リスクが生じ、意図しない結果が生じる可能性があるためです。したがって、ワイルドカードの使用を避け、代わりに可能な限り明示的な値を使用することをお勧めします。

次に、次のコードに示すように CloudWatch ログ グループ リソースを作成し、ログをこのグループに送信します。

  #Log Group
  LexLogGroup:
    Type: AWS::Logs::LogGroup
    Properties:
      LogGroupName: /lex/hotel-bot
      RetentionInDays: 5

最後に、エイリアスを更新して会話ログ設定を有効にします。

BookHotelDemoAlias:
    Type: AWS::Lex::BotAlias
    Properties:
      BotId: !Ref BookHotelBot
      BotAliasName: "BookHotelDemoAlias"
      BotVersion: !GetAtt BookHotelConditionalBranches.BotVersion
      BotAliasLocaleSettings:
        - LocaleId: en_US
          BotAliasLocaleSetting:
            Enabled: true
            CodeHookSpecification:
              LambdaCodeHook:
                CodeHookInterfaceVersion: "1.0"
                LambdaArn: !GetAtt HotelBotFunction.Arn
      ConversationLogSettings:
        TextLogSettings:
          - Destination:
              CloudWatch:
                CloudWatchLogGroupArn: !GetAtt LexLogGroup.Arn
                LogPrefix: bookHotel
            Enabled: true

このテンプレートでスタックを更新すると、ボットの会話ログが有効になります。ボット リソースには変更がないため、この手順では新しいバージョンは作成されません。あなたはできる 最新バージョンのテンプレートをダウンロードする.

クリーンアップ

今後料金が発生しないようにするには、作成した CloudFormation スタックを削除します。

まとめ

この投稿では、Amazon Lex V2 ボット用の CloudFormation テンプレートを作成するための段階的なプロセスについて説明しました。最初に、基本的なボットをデプロイし、次にエイリアスとバージョンの可能性と、それらをテンプレートで効率的に使用する方法を調査しました。次に、Lambda 関数を Amazon Lex V2 ボットと統合する方法を学び、ビジネス要件に対応するためにボットの会話フローに条件分岐を実装しました。最後に、CloudWatch ログ グループ リソースを作成し、必要な権限でボットのロールを更新することで、ログ機能を追加しました。

このテンプレートを使用すると、ボットの簡単な展開と管理が可能になり、必要に応じて変更を元に戻すことができます。全体として、CloudFormation テンプレートは、Amazon Lex V2 ボットの管理と最適化に役立ちます。

次のステップとして、次のことを検討できます。 サンプル Amazon Lex ボット この投稿で説明した手法を適用して、それらを CloudFormation テンプレートに変換します。この実践的な演習により、コードとしてのインフラストラクチャを介した Amazon Lex V2 ボットの管理についての理解が深まります。


著者について

AWS CloudFormation テンプレートを使用して Amazon Lex ボットを管理する |アマゾン ウェブ サービス PlatoBlockchain データ インテリジェンス。垂直検索。あい。トーマス・リンドファス Amazon Lex チームのシニア ソリューション アーキテクトです。 彼は、カスタマー エクスペリエンスを向上させ、導入を容易にする言語 AI サービスの新しい技術機能とソリューションを発明、開発、プロトタイプ作成し、普及させています。

AWS CloudFormation テンプレートを使用して Amazon Lex ボットを管理する |アマゾン ウェブ サービス PlatoBlockchain データ インテリジェンス。垂直検索。あい。リジーシュ・アッカンベス・チャトート AWS のプロフェッショナル サービス コンサルタントです。彼は顧客が望むビジネスを達成できるよう支援します
Amazon Connect、Amazon Lex、GenAI の機能を活用することで、コンタクトセンター分野で成果をもたらします。

タイムスタンプ:

より多くの AWS機械学習