Generate SES smtp credentials for a given user and store the credentials in a SecretsManager Secret.
Project description
AWS CDK Ses Smtp Credentials
Generate SES smtp credentials for a user and store the credentials in a SecretsManager Secret.
Install
TypeScript
npm install @pepperize/cdk-ses-smtp-credentials
or
yarn add @pepperize/cdk-ses-smtp-credentials
Python
pip install pepperize.cdk-ses-smtp-credentials
C# / .Net
dotnet add package Pepperize.CDK.SesSmtpCredentials
Java
<dependency>
<groupId>com.pepperize</groupId>
<artifactId>cdk-ses-smtp-credentials</artifactId>
<version>${cdkSesSmtpCredentials.version}</version>
</dependency>
Usage
npm install @pepperize/cdk-ses-smtp-credentials
See API.md.
Create AWS SES Smtp Credentials for a given user
Attaches an inline policy to the user allowing to send emails
import { User } from "@aws-cdk/aws-iam";
import { SesSmtpCredentials } from "@pepperize/cdk-ses-smtp-credentials";
const user = new User(stack, "SesUser", {
userName: "ses-user",
});
const smtpCredentials = new SesSmtpCredentials(this, "SmtpCredentials", {
user: user,
});
// smtpCredentials.secret contains json value {username: "<the generated access key id>", password: "<the calculated ses smtp password>"}
See API Reference - SesSmtpCredentials
Create AWS SES Smtp Credentials and create a new user
Attaches an inline policy to the user allowing to send emails
import { User } from "@aws-cdk/aws-iam";
import { SesSmtpCredentials } from "@pepperize/cdk-ses-smtp-credentials";
const smtpCredentials = new SesSmtpCredentials(this, "SmtpCredentials", {
userName: "ses-user",
});
// smtpCredentials.secret contains json value {username: "<the generated access key id>", password: "<the calculated ses smtp password>"}
See API Reference - SesSmtpCredentials
Calculate the AWS SES Smtp password on your own
import * as AWS from "aws-sdk";
import { calculateSesSmtpPassword } from "@pepperize/cdk-ses-smtp-credentials";
const iam = new AWS.IAM();
const accessKey = await iam
.createAccessKey({
UserName: username,
})
.promise();
const accessKeyId = accessKey.AccessKey.AccessKeyId;
const secretAccessKey = accessKey.AccessKey.SecretAccessKey;
const password = calculateSesSmtpPassword(secretAccessKey, "us-east-1");
console.log({
username: accessKeyId,
password: password,
});
See Obtaining Amazon SES SMTP credentials by converting existing AWS credentials
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pepperize.cdk-ses-smtp-credentials-0.3.183.tar.gz
.
File metadata
- Download URL: pepperize.cdk-ses-smtp-credentials-0.3.183.tar.gz
- Upload date:
- Size: 38.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2da0c02c2a233b11d88f413831479e0e459d32de98dd1462966b51921e83fd9d |
|
MD5 | d8f5864e7c76a0cfaea45b5b6906d6cc |
|
BLAKE2b-256 | 2a89025e65eb1455b9c0c5c30ffe83b2b19633194b693e330e5e927bfe8b48ae |
Provenance
File details
Details for the file pepperize.cdk_ses_smtp_credentials-0.3.183-py3-none-any.whl
.
File metadata
- Download URL: pepperize.cdk_ses_smtp_credentials-0.3.183-py3-none-any.whl
- Upload date:
- Size: 38.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 21958c2d0361e0f3a8fe3f2add6f4e7c8386d2810b79c29320cf7030d6e994be |
|
MD5 | 86865993ed1f64dfcb02fbee406cbecc |
|
BLAKE2b-256 | 058c8408fee35162150bc8b176e8c0ecd02ffc766cf6a5dd91f88da868e0b566 |