Chapter 5. Downloading files from available Amazon S3 buckets using notebook cells

You can download a file to your notebook server using the download_file method.



  1. Define the following in a notebook cell:

    1. The bucket that the file is in.

      bucket_name = name_of_the_bucket
    2. The name of the file to download.

      file_name = name_of_the_file_to_download # Full path from the bucket
    3. The name that you want the file to have after it is downloaded. This can be a full path, a relative path, or just a new file name.

      new_file_name = name_of_the_file_once_downloaded
  2. Download the file, specifying the previous variables as arguments.

    s3_client.download_file(bucket_name, file_name, new_file_name)

    If you want to retrieve a file as an object that you can then stream as a standard file using the read() method, refer to the Amazon Sev Services get object command reference