import re


def formatKey(input):
    """
    formatKey converts the parameter key stored in ssm into
    the traditional env. variable key format

    examples:
    /my-app/foo.bar -> FOO_BAR
    /my-app/dev/hello-world -> HELLO_WORLD
    /my-app/sbx/alpha/job_one -> JOB_ONE
    """
    paths = input.split('/')
    keyName = paths[-1] # last item is key name
    formattedKey = re.sub(r'[\.\-\_]', '_', keyName).upper()
    return formattedKey