def get_dict_from_key()

in lib/custom_resources/create_and_attach_scp.py [0:0]


def get_dict_from_key(s3_bucket: str, key: str) -> dict:
    """

    :param s3_bucket: S3 bucket name
    :param key: Key of the object
    :return: Dictionary of the S3 object contents
    """
    content = s3_resource.Object(s3_bucket, key).get()['Body'].read().decode('utf-8')
    data = json.loads(content)
    return data