Taming the White Whale - Email

28 January 2020

How do I coordinate with 8 people in different groups? How does an airline tell me about changes to next week’s flight? What’s a good way for a long-lost friend to reach me?

The most popular online communication tool is one of the oldest: email. It’s used for everythig: personal messages, alerts, marketing, etc.

Email is a beast that follows our every footstep.

Its flexibility makes it a challenge. I get emails with varying mental and time requirements. How can I process the emails I receive? How can I send emails that gets me the responses I’m looking for?

I want to organize my communication, and make it optimally useful at minimal cost.*

Context

Email sits in the intersection of security, identity, privacy, communication, and human perception.

There are assumptions we make:

  • Only I can read my email
  • I can contact someone via email and only they will see it
  • I can store emails in my account and they will be secure
  • It’s a good way to send information to people
  • It’s a good way for people to send information to me

Consider identity. I bet you have an email address, or more than one. They are part of your identity. Heck, you may advertise them on your blog, or a business card.

Second, ubiquity. Email has powerful network effects and utility. Anyone can contact you, and you can respond to them instantly. Network effects influence your life.

What about privacy? Someone can find your email address by Googling your name. Email is a public way to contact you. Your phone number and physical address have some expectation of privacy. Your email address, not so much.

Security is a big consideration. Institutions you interact with use email to authenticate you. For example, online banking requires an email address. Your phone company, landlord, and airline all know it.

If I had nefarious intentions, knowing your email address gives me a way to target you. It’s the skeleton key to your online life. Good email security fundamentals are critical.

Uses

I categorize email by its intended use:

  • Personal communication - sending messages to loved ones. This is the closest analogy to writing a personal letter & mailin it.
  • Work communication - sending/receiving messages, often for coordination purposes. This is being superseded by messaging applications like Slack.
  • Personal notes - reminders to myself, e.g. Get coffee on the way home, put $ into savings tonight, or remember your passport
  • Reference - Useful details, often within a specific timeframe. Plane ticket confirmations are a great example.
  • Alerts - Important + infrequent automated messages. Bank fraud warnings are one example.
  • Unwanted - Spam. Phishing attempts. Contact from companies you may have interacted with, but don’t want to hear from again. This is 99% of the email you receive; thank goodness for spam filters.

[](https://en.wikipedia.org/wiki/Spam_(Monty_Python)

Some of these intended uses overlap. Others conflict.

Let’s categorize the way I use email a differetn way, by sources and destinations:

Interaction Patterns

There are common email interaction patterns:

Quick Items

I use email to send quick messages, alerts, or announcements. These messages take only a few minutes to resolve.

Search

Some emails are a knowledgebase. This is common; that’s why Gmail’s main interface is search.

Threads

Modern email apps group a conversation into a thread, so it’s shown together. This is a great idea.

Timing

An email is often useful at a certain time. For example, that email confirmation about my flight? I want receive it soon after booking, and then ‘snooze’ it until a few days before I travel. It’s clutter in the interim.

A missive from a friend, on the other hand? I want to see it immediately.

Make Tools Yours

Tools are for your use. They should suit your needs, not the other way around.

I use different email accounts for different purposes: for friends, for work, and for my career. Each account has different settings for notifications, app integration, and privacy.

Communication

Email is a tool for transmitting text. This has great advantages (permanence, legibility). It also has drawbacks (tone of voice, no body language). There’s a margin of error, and it’s pretty big. Words are ambiguous. Connotations and idioms are not universal.

With any communication tool, there is a gap between what you intend to say and what people perceive.

People don’t read email. Many people spend < 60 seconds reading an email. Many things compete for our attention; giving everything short shrift is natural.

Email suffers from the timing and frequency constraints that bedevil all communication. Being effective is key.

Here’s what I do:

  • Keep it short. Shorter. Even shorter than that.
    • “Is this the minimal length that has necessary info?”
  • Put the important details at the top, in bullet points
  • Message only when necessary. Repetition breeds disregard
  • Long emails are ignored. Go for clarity & brevity. If elaborate details are important, do it by voice. The bandwidth is far higher.
  • No ambiguity. I use inside jokes, but only with people who know them.

Email is useful sometimes:

  • “Can the recipient resolve this in < 3 minutes?”
  • “Does this need minimal interaction?”
    • Back-and-forth is messaging. Anything else, and use high-bandwidth voice.
  • “Will this person need to find this in several days?”

I use standard formats:

Work Communication

Tl;dr - <one-sentence summary>

The Long Version:
<background>
<process + data>
<result>

Announcements + Notifications

I send announcements at times.

Hey folks, here's the details for <event/subject>

* When - 
* Where - 
* What to Bring - 
* Important Topic - 

The consistency and format works well for distracted people.

Search

Search is a different beast; my words interact with a search utility, and not a human.

I use keywords. If I’m writing about a trip to LA in March, I’ll include words like ‘family’, ‘flight’, ‘travel’, ‘itinerary’, ‘March’, ‘California’, ‘LA’, and ‘Los Angeles’.

I can search using key words/phrases to find this email, quickly. This is an old trick. If you get an email with a plane ticket confirmation, or an Amazon order, it has key words & phrases in it.

To-Do

These are very short. For example, today I wrote a reminder to myself, to get my niece some books:

niece books

…that’s it. Just enough to jog my memory. I’ll route it into my to-do system later.

Email is a tool. Its effects depend on our intentions, and our methods.

I use email in specific ways because I’m perennially busy. I’d rather spend my time on better problems than puzzling out the optimal format for each email.

How do you use email?

Permalink

A useful script for AWS credentials

21 January 2020

My work involves elevated access to computers, including Amazon Web Services (AWS) accounts.

Our security team requires multi-factor authentication (MFA) for elevated access. For command-line access using MFA, I use the awscli’s aws sts get-session-token function. This grants AWS security credentials that are valid for a few hours.

I do this multiple times each day, so I made a quick utility script: sessioner.

To set up my credentials, I run the following commands:

. sessioner.sh -e development -t <development_token_value>
. sessioner.sh -e testing -t <testing_token_value>
. sessioner.sh -e production -t <production_token_value>

The token values come from an MFA device.

This code has 5 parts. Let’s take a look…

Part A: Input Parsing

The first step is to parse the inputs.

The script needs 2 parameters: the AWS profile (-e or --env) and MFA token code (-t or --token).

# inputs needed - environment (ENV) and code (TOKEN)
echo [email protected]
POSITIONAL=()
while [[ $# -gt 0 ]]
do
key="$1"

case $key in
    -e|--env)
    ENV="$2"
    shift # past argument
    shift # past value
    ;;
    -t|--token)
    TOKEN="$2"
    shift # past argument
    shift # past value
    ;;
    *)    # unknown option
    POSITIONAL+=("$1") # save it in an array for later
    shift # past argument
    ;;
esac
done
set -- "${POSITIONAL[@]}" # restore positional parameters

Part B: Environment Setup

The second step is to create a few variables; the MFA device serial number, and the AWS profilename with elevated permissions.

Let’s say I’m connecting to AWS accounts 111111111111 and 222222222222 for development and testing. Inside each is an IAM user with elevated access called DevTheAlmighty.

if [ "${ENV}" = "development" ]; then
  SERIAL='arn:aws:iam::111111111111:mfa/DevTheAlmighty'
fi

if [ "${ENV}" = "testing" ]; then
  SERIAL='arn:aws:iam::222222222222:mfa/DevTheAlmighty'
fi

PROFILENAME="$ENV"mfa

Inside my AWS credentials, I have 2 configurations for each AWS account. I use the development profile to get credentials for the developmentmfa profile. The former has limited permissions; it can only retrieve permissions for the latter.

[development]
region = us-east-1

[developmentmfa]
region = us-east-1

Part C: Get Session Credentials

I get temporary credentials via aws sts get-session-token, which returns a JSON object. I run the command and save the results to a variable.

echo "Configuring $ENV with token $TOKEN"
CREDJSON="$(aws sts get-session-token --serial-number $SERIAL --profile $ENV --token-code $TOKEN)"
#echo $CREDJSON

Jq navigates through the JSON on the command line, and then sed removes the " character.

One line of code assigns an access_key, secret_key, or session_token value to a variable.

ACCESSKEY="$(echo $CREDJSON | jq '.Credentials.AccessKeyId' | sed 's/"//g')"
SECRETKEY="$(echo $CREDJSON | jq '.Credentials.SecretAccessKey' | sed 's/"//g')"
SESSIONTOKEN="$(echo $CREDJSON | jq '.Credentials.SessionToken' | sed 's/"//g')"

Part D: Set Session Credentials

aws configure set sets credentials for the higher-permissions profile.

aws configure set aws_access_key_id $ACCESSKEY --profile $PROFILENAME
aws configure set aws_secret_access_key $SECRETKEY --profile $PROFILENAME
aws configure set aws_session_token $SESSIONTOKEN --profile $PROFILENAME

Part E: Validate

Has my script worked? I run a simple check: listing all the S3 buckets I can see. Their names are familiar and distinctive, so I immediately know which AWS account I’m using.

aws s3 ls / --profile $PROFILENAME

I’ve put my code on GitHub, since no piece of code is ever done. I’ll add functionality over time, as I need to.

Happy coding!

Permalink