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 by using the upload_file
method.
Prerequisites
- Configure an Amazon S3 client in a previous cell in the notebook. See Creating an Amazon S3 client using notebook cells for more information.
Procedure
Define the following details in a notebook cell:
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>'
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>'
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>'
Upload the file, specifying the previous variables as arguments.
s3_client.upload_file(file_name, bucket_name, key)