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

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

Prerequisites

Procedure

  1. Define the following details in a notebook cell:

    1. The name of the file to upload. This must include the full local path to the file. Replace <name_of_the_file_to_upload> with your own value.

      file_name = '<name_of_the_file_to_upload>'
    2. The name of the bucket to upload the file to. Replace <name_of_the_bucket> with your own value.

      bucket_name = '<name_of_the_bucket>'
    3. The full key to use to save the file to the bucket. Replace <full_path_and_file_name> with your own value.

      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)