def aws(client, path, opt):
    """Renders a shell environment snippet with AWS information"""

    try:
        creds = client.read(path)
    except (hvac.exceptions.InternalServerError) as vault_exception:
        # this is how old vault behaves
        if vault_exception.errors[0].find('unsupported path') > 0:
            emsg = "Invalid AWS path. Did you forget the" \
                   " credential type and role?"
            raise aomi.exceptions.AomiFile(emsg)
        else:
            raise

    # this is how new vault behaves
    if not creds:
        emsg = "Invalid AWS path. Did you forget the" \
               " credential type and role?"
        raise aomi.exceptions.AomiFile(emsg)

    renew_secret(client, creds, opt)

    if creds and 'data' in creds:
        print("AWS_ACCESS_KEY_ID=\"%s\"" % creds['data']['access_key'])
        print("AWS_SECRET_ACCESS_KEY=\"%s\"" % creds['data']['secret_key'])
        if 'security_token' in creds['data'] \
           and creds['data']['security_token']:
            token = creds['data']['security_token']
            print("AWS_SECURITY_TOKEN=\"%s\"" % token)
    else:
        client.revoke_self_token()
        e_msg = "Unable to generate AWS credentials from %s" % path
        raise aomi.exceptions.VaultData(e_msg)

    if opt.export:
        print("export AWS_ACCESS_KEY_ID")
        print("export AWS_SECRET_ACCESS_KEY")
        if 'security_token' in creds['data'] \
           and creds['data']['security_token']:
            print("export AWS_SECURITY_TOKEN")
Renders a shell environment snippet with AWS information