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
Close
Hashes for pepperize.cdk-ses-smtp-credentials-0.3.522.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | a2032e257bd2804066404dccb49688cbe83f0197da7ecfece10987a1d04eb69d |
|
MD5 | 03ee3a89153077f39b0fb822e83ed803 |
|
BLAKE2b-256 | 5fd99268d9502ab9b4374c8b845e34cc69566abba5395a64023289d6c8a92fbd |
Close
Hashes for pepperize.cdk_ses_smtp_credentials-0.3.522-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | df7edb159319e862f18a5193fdf722aaef8312e682459a9d764fe3f46ea635f6 |
|
MD5 | 00e75af6ae9f6c2faa91db8c523b8dea |
|
BLAKE2b-256 | 29c1cf81162b5db6fdf666deec35872e281f45e2289a1144df1b98f6cbbf0b14 |