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 Answer
2
Accepted Answer

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
EXPERT
answered 10 months ago
profile pictureAWS
EXPERT
reviewed 10 months ago
profile picture
EXPERT
reviewed 10 months ago
  • Thanks for the clarification! The first link really helped me understand the syntax differences between the v3 style versus the v2 style.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions