Connect Saturn Cloud to Your Data
Saturn does not host data, but we know that accessing your data is vital for your data science practice. We have several options for linking your data sources to your Saturn Cloud account. If your data source is not listed here, please contact us at hello@saturncloud.io or on our community Slack and we’ll help you!
S3
If you use AWS S3 to store your data, connecting to Saturn Cloud takes just a couple of steps.
To connect to public S3 buckets, you can simply connect using anonymous connections in Jupyter, the way you might with your local laptop, for example using Python libraries like s3fs or boto3.
If your S3 data storage is not public, but requires AWS credentials, please read on.
Create AWS Credentials
Credentials for S3 access can be acquired inside your AWS account. Visit https://aws.amazon.com/ and sign in to your account.
Under “My Security Credentials” you’ll see section titled “Access keys for CLI, SDK, & API access”.
If you don’t yet have an access key listed, create one. Save the key information that this generates, and keep it in a safe place!
We strongly recommend using the Credentials feature in Saturn Cloud to store any credentials. This means your credentials will be easy for you to access, but secure and safe.
Add AWS Credentials to Saturn Cloud
Now, return to the Saturn Cloud platform and select Credentials.
This is where you will add your AWS access key information. This is a secure storage location, and will not be available to the public or other users without your consent.
At the top right corner of this page, you will find the “Create” button. Click here, and you’ll be taken to the Credentials Creation form. You will be adding at least three credentials items. When creating AWS credentials, you’ll choose “Environment Variable” as the type of credential for everything you’re adding.
These are the items you need to add - they are all necessary for Saturn Cloud to connect to S3. The name choices are recommendations, but you are welcome to change them as needed for your workflow.
Credential | Name | Variable Name | Type |
---|---|---|---|
AWS Access Key ID | aws-access-key-id | AWS_ACCESS_KEY_ID | Environment Variable |
AWS Secret Access Key | aws-secret-access-key | AWS_SECRET_ACCESS_KEY | Environment Variable |
AWS Default Region | aws-default-region | AWS_DEFAULT_REGION | Environment Variable |
Complete the form one time for each item. When completed, you should see the credentials now in the Credentials page, like this.
When this is all complete, you can create a resource and your S3 credentials will be accessible by Python. You can use libraries such as s3fs or boto3 to access your private buckets and rest assured your credentials are secure.
For more information about working with S3 data storage, please see our Tutorials about loading data.
Snowflake
Snowflake is a data platform built for the cloud that allows for fast SQL queries. This example shows how to query data in Snowflake and pull into Saturn Cloud for data science work. We will rely on the Snowflake Connector for Python to connect and issue queries from Python code.
The images that come with Saturn come with the Snowflake Connector for Python installed. If you are building your own images and want to work with Snowflake, you should include snowflake-connector-python
in your environment.
We strongly recommend using the Credentials feature in Saturn Cloud to store any credentials. This means your credentials will be easy for you to access, but secure and safe.
Add Snowflake Credentials to Saturn Cloud
Open the Saturn Cloud platform, and click the “Tools” section, and select “Credentials”.
This is where you will store your Snowflake credential information. This is a secure storage location, and will not be available to the public or other users without your consent.
At the top right corner of this page, you will find the “Create” button. Click here, and you’ll be taken to the Credentials Creation form. You will be creating at least three credentials items. When creating Snowflake credentials, you’ll choose “Environment Variable” as the type of credential for everything you’re adding.
These are the items you need to add - they are all necessary for Saturn Cloud to connect to Snowflake. The name choices are recommendations, but you are welcome to change them as needed for your workflow.
Credential | Name | Variable Name | Type |
---|---|---|---|
Snowflake account | snowflake-account | SNOWFLAKE_ACCOUNT | Environment Variable |
Snowflake username | snowflake-user | SNOWFLAKE_USER | Environment Variable |
Snowflake user password | snowflake-password | SNOWFLAKE_PASSWORD | Environment Variable |
Complete the form one time for each item. When completed, you should see the credentials now in the Credentials page, like this.
After this is done, you will need to restart any Jupyter Server or Dask Clusters (if you add credentials while they are running). Then from a notebook where you want to connect to Snowflake, you can read in the credentials and then provide additional arguments if necessary:
import os
import snowflake.connector
conn = snowflake.connector.connect(
account=os.environ['SNOWFLAKE_ACCOUNT'],
user=os.environ['SNOWFLAKE_USER'],
password=os.environ['SNOWFLAKE_PASSWORD'],
warehouse='MY_WAREHOUSE',
database='MY_DATABASE',
schema='MY_SCHEMA',
)
At this point, you can access your Snowflake database the same way you would on a laptop or local machine. For more information about working with Snowflake data storage, please see our Tutorial about loading data.
Need help, or have more questions? Contact us at:
- support@saturncloud.io
- On Intercom, using the icon at the bottom right corner of the screen
We'll be happy to help you and answer your questions!