Chapter 6. Downloading files from your bucket


To download a file from your bucket to your workbench, use the download_file() method.

Prerequisites

  • You have cloned the odh-doc-examples repository to your workbench.
  • You have opened the s3client_examples.ipynb file in your workbench.
  • You have installed Boto3 and configured an S3 client.

Procedure

  1. In the Jupyter notebook, locate the following instructions to download files from a bucket:

    #Download file from bucket
    #Replace the following values with your own:
    #<bucket_name>: The name of the bucket.
    #<object_name>: The name of the file to download. Must include full path to the file on the bucket.
    #<file_name>: The name of the file when downloaded.
    
    s3_client.download_file('<bucket_name>','<object_name>','<file_name>')
    Copy to Clipboard
  2. Modify the code sample:

    1. Replace <bucket_name> with the name of the bucket that the file is located in…​ Replace <object_name> with the name of the file that you want to download.
    2. Replace <file_name> with the name and path that you want the file to be downloaded to, as shown in the example.

      s3_client.download_file('aqs086-image-registry',
                              'series35-image36-086.csv',
                              '\tmp\series35-image36-086.csv_old')
      Copy to Clipboard
  3. Run the code cell.

Verification

  • The file that you downloaded appears in the path that you specified on your workbench.
Back to top
Red Hat logoGithubredditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust. Explore our recent updates.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

Theme

© 2025 Red Hat