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'});
};
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
전문가
답변함 일 년 전
profile pictureAWS
전문가
검토됨 일 년 전
profile picture
전문가
검토됨 일 년 전
  • Thanks for the clarification! The first link really helped me understand the syntax differences between the v3 style versus the v2 style.

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠