Added compatibility with passing S3 url for the template instead of a local file.