Skip to main content

Generate SES smtp credentials for a given user and store the credentials in a SecretsManager Secret.

Project description

PRs Welcome GitHub npm (scoped) PyPI Nuget Sonatype Nexus (Releases) GitHub Workflow Status (branch) GitHub release (latest SemVer) Gitpod ready-to-code

AWS CDK Ses Smtp Credentials

Generate SES smtp credentials for a user and store the credentials in a SecretsManager Secret.

View on Construct Hub

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

pepperize.cdk-ses-smtp-credentials-0.3.552.tar.gz (1.6 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file pepperize.cdk-ses-smtp-credentials-0.3.552.tar.gz.

File metadata

File hashes

Hashes for pepperize.cdk-ses-smtp-credentials-0.3.552.tar.gz
Algorithm Hash digest
SHA256 c07fa64f04af1f2a011e093f0c1d81cf5a3ef359a9a29a2e8c44413e63e700c5
MD5 f3117e94144c38ecadc9c1f9523f0a38
BLAKE2b-256 4739d8ee0c209192b3bc73c60d3ab3f71c2ce696ab219e509f9226f9a54e3a1b

See more details on using hashes here.

File details

Details for the file pepperize.cdk_ses_smtp_credentials-0.3.552-py3-none-any.whl.

File metadata

File hashes

Hashes for pepperize.cdk_ses_smtp_credentials-0.3.552-py3-none-any.whl
Algorithm Hash digest
SHA256 6330aae6f241b9e1a8f7ea76b48027cfe90f2fba3b28ed76752d08903ba6e213
MD5 184fedd5cc8968e85ed4da8eb48d58d3
BLAKE2b-256 9556b02daeeff199a33bf7d96af2a3add000bb12b66be3def1ef63e652b2c26c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page