What is the difference between using the "Client" versus "non-Client" versions of AWS API calls?

0

I am confused as to when to use the "Client" versus "non-Client" versions from the AWS SDK. In the code I reproduced below, I am creating a lambda function to send input text to Amazon Lex for processing. Can someone explain what the differences are and when to use the different versions?

import { LexRuntimeV2Client, RecognizeTextCommand } from "@aws-sdk/client-lex-runtime-v2";
import { LexRuntimeV2 } from "@aws-sdk/client-lex-runtime-v2";

export const handler = async(event) => {

    const LEXRUNTIMEClient = new LexRuntimeV2Client({region: 'us-east-1'});
    const LEXRUNTIME = new LexRuntimeV2({region: 'us-east-1'});
};
profile picture
已提问 1 年前244 查看次数
1 回答
2
已接受的回答

Hi Albert.

These two are equivalent versions of the same client. You can use either, however, please favor using LexRuntimeV2Client. per the documentation, the client can also send requests using v2 compatible style (LexRuntimeV2). However, it results in a bigger bundle size and may be dropped in next major version.

More details can be found here:

I hope this helps.

profile pictureAWS
专家
已回答 1 年前
profile pictureAWS
专家
已审核 1 年前
profile picture
专家
已审核 1 年前
  • Thanks for the clarification! The first link really helped me understand the syntax differences between the v3 style versus the v2 style.

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则

相关内容