Chapter 6. Uploading files to available Amazon S3 buckets using notebook cells

You can upload files from your notebook server to an Amazon S3 bucket using the upload_file method.

Prerequisites

Procedure

  1. Define the following in a notebook cell:

    1. The name of the file to upload. This must include the full local path to the file.

      file_name = name_of_the_file_to_upload
    2. The name of the bucket to upload the file to.

      bucket_name = name_of_the_bucket
    3. The full key to use to save the file to the bucket.

      key = full_path_and_file_name
  2. Upload the file, specifying the previous variables as arguments.

    s3_client.upload_file(file_name, bucket_name, key)