import json


def publish_layer(lambda_client, zip_path: str, layer_name: str) -> str:
    """Publishes a new lambda layer or new version of an existing lambda layer
    
    Returns the arn (with version) of the created resource."""
    print(f"Publishing lambda layer {layer_name}")

    with open(zip_path, "rb") as f:
        zipfile = f.read()

    response = lambda_client.publish_layer_version(
        LayerName=layer_name,
        Content={"ZipFile": zipfile},
        CompatibleRuntimes=["python3.8"],
        LicenseInfo="MIT",
    )

    print(json.dumps(response, indent=4))
    return response["LayerVersionArn"]