Sign inGet started
← Back to all guides

How to use Amazon S3 with Juptyer

By Nick Barth

Updated on March 6, 2024

Amazon Simple Storage Service (Amazon S3) is a scalable storage service that allows users to store and retrieve data from the cloud.

To use Amazon S3 with Jupyter notebooks, you first need to set up an AWS account and create an S3 bucket. Once your bucket is ready, you can use libraries such as `boto3` to interact with S3. To interface with S3 from a Jupyter notebook, you would typically import `boto3`, configure your AWS credentials, and then use the library's methods to upload, download, and manage your files on S3. Here is an example of how you might start:

import boto3

Initialize a session using Amazon S3 credentials

session = boto3.Session(
⁠
⁠    aws_access_key_id='<YOUR_ACCESS_KEY>',
⁠
⁠    aws_secret_access_key='<YOUR_SECRET_KEY>',
⁠
⁠    region_name='<YOUR_REGION>'
⁠
⁠)

Create an S3 client

s3 = session.client('s3')

Now you can use S3 to interact with your buckets.

This snippet of code is the beginning of how you would set up your Jupyter notebook for S3 interaction. The next steps in the document would be to show actual interaction with the S3 bucket, such as listing contents, uploading files, and reading files directly into data frames for analysis in Jupyter.

That’s it, time to try Deepnote

Get started – it’s free
Book a demo

Footer

Product

  • Integrations
  • Pricing
  • Documentation
  • Changelog
  • Security

Company

Comparisons

Resources

  • Privacy
  • Terms

© Deepnote