title: How to generate URL to download file from S3 bucket
body: <p>I would like to obtain URLs pointing to cloud-optimized geoTIFFs from Amazon's <a href="https://registry.opendata.aws/copernicus-dem/" rel="nofollow noreferrer">Copernicus Digital Elevation Model</a> bucket.</p>
  <p>After installing <code>boto3</code> (with <code>pip3 install boto3</code>), I do, relying on <a href="https://stackoverflow.com/a/34866092/8565438">this answer</a> to the question <a href="https://stackoverflow.com/questions/34865927/can-i-use-boto3-anonymously/34866092#34866092">Can I use boto3 anonymously?</a> to download a single file:</p>
  <pre><code>import boto3
  from botocore import UNSIGNED
  from botocore.client import Config
  
  s3 = boto3.client('s3', region_name='eu-central-1', config=Config(signature_version=UNSIGNED))
  </code></pre>
  <p>Then I query for list of objects in the bucket, using the second line of <a href="https://stackoverflow.com/a/42091396/8565438">this answer</a> to the question <a href="https://stackoverflow.com/questions/42090830/use-boto3-to-download-from-public-bucket">Use boto3 to download from public bucket</a>:</p>
  <pre><code>objects = s3.list_objects(Bucket='copernicus-dem-30m')
  </code></pre>
  <p>I then access to a value in <code>objects['Contents']</code>, the first one, for example (ie index <code>0</code>):</p>
  <pre><code>key = objects['Contents'][0]['Key']
  </code></pre>
  <p><code>key</code> is now:</p>
  <pre><code>Copernicus_DSM_COG_10_N00_00_E006_00_DEM/Copernicus_DSM_COG_10_N00_00_E006_00_DEM.tif
  </code></pre>
  <p>I download this file by doing:</p>
  <pre><code>s3.download_file('copernicus-dem-30m', key, key.split('/')[-1])
  </code></pre>
  <p><strong>Instead of downloading, how can I generate a URL, which later I can use to download the file, maybe using <code>wget</code> or just pasting it to a browswer?</strong></p>
  <hr />
  <p><sub> This code shown above is based on the thread: <a href="https://gis.stackexchange.com/questions/412437/how-to-get-copernicus-dem-geotiffs-for-a-bounding-box-using-python">How to get Copernicus DEM GeoTIFFs for a bounding box using Python</a>.</sub></p>