Convert IAM Secret Access Key to SES SMTP Password in Bash

Obtaining Amazon SES SMTP credentials by converting AWS credentials in Bash.

Using Debian Wheezy

Install OpenSSL and git:

# apt-get update && apt-get install openssl git

Get a bash SES SMTP converter from GitHub:

$ git clone

Change to folder and make the script executable:

$ cd ./aws-scripts
$ chmod u+x ./

Convert an IAM secret access key to a SES SMTP password:

$ ./ AWSAccessKeyID AWSSecretAccessKey

Where AWSAccessKeyID is your AWS access key ID and AWSSecretAccessKey is your AWS secret access key.

Bash Code That Does All the Magic

VerInBytes=$(printf \\$(printf '%03o' "$VerInBytes"));

SignInBytes=$(echo -n "$MSG"|openssl dgst -sha256 -hmac "$IAMSECRET" -binary);
SmtpPass=$(echo -n "$SignAndVer"|base64);

Leave a Reply

Your email address will not be published. Required fields are marked *