Initial version plucked from aws-cli.