After poking around, the AWS SDK for JavaScript seems to have two versions:
- Version 2 under
@aws-sdk: https://www.npmjs.com/package/aws-sdk - Version 3 under
@aws-sdk/client-*: e.g., https://www.npmjs.com/package/@aws-sdk/client-ses
Version 2 of the SDK is meant to be entering maintenance mode in 2023.
Now that this first layer of confusion is cleared out, the AWS SES API also has 2 versions:
- SES API v1: https://docs.aws.amazon.com/cli/latest/reference/ses/index.html
- SES API v2: https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ses/index.html
So based on this investigation, I presume that the packages points to the different API versions.
Answer from Nicolas Bouvrette on Stack Overflow
» npm install @aws-sdk/client-ses
Could we recommend developers to install `@aws-sdk/client-ses` directly? We now need to install `aws-sdk` first, then migrate from v2 to v3 with `aws-sdk-js-codemod`.
How to hard code credentials AWS SES JS SDK V3
What's the up to date way of sending emails with AWS SES
SDK + CLI for AWS SES (Modern DX, your infrastructure) – what AWS service should I wrap next?
Videos
After poking around, the AWS SDK for JavaScript seems to have two versions:
- Version 2 under
@aws-sdk: https://www.npmjs.com/package/aws-sdk - Version 3 under
@aws-sdk/client-*: e.g., https://www.npmjs.com/package/@aws-sdk/client-ses
Version 2 of the SDK is meant to be entering maintenance mode in 2023.
Now that this first layer of confusion is cleared out, the AWS SES API also has 2 versions:
- SES API v1: https://docs.aws.amazon.com/cli/latest/reference/ses/index.html
- SES API v2: https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ses/index.html
So based on this investigation, I presume that the packages points to the different API versions.
According to this post, SESv2 API is introduced in 2020 as apposed to other OP says, so v2 is the newer version.
» npm install @aws-sdk/client-sesv2
» npm install @aws-sdk/client-ses-node
You are referring only to the reference docs. To work with AWS SDK for JavaScript v3, refer to the Developer Guide:
AWS SDK for JavaScript Developer Guide for SDK Version 3
This guide contains the information you need to know to successfully work with this SDK. For example, to work and set your credentials, see:
Setting Credentials
Finally -- you can find many SES Code examples that use the AWS SDK for JavaScript in this Github repo.
https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/javascriptv3/example_code/ses
The Send Email example is included here.
You can do following:
import aws from "aws-sdk";
aws.config.update({
region: "...",
credentials: {
accessKeyId: "...",
secretAccessKey: "..."
}
})
In the next line you can now use your SES
const client = new aws.SES();