Borrow a cluster in the cloud
Lots of companies will rent you a whole cluster of computers with a Spark notebook already set up on it, and several will let you use a small one for free โ partly out of kindness, and partly because they hope you'll like it enough to expense a big one later. It all happens in a web browser, so this is also the way to go if you have a tablet or Chromebook rather than a computer you can install things on.
This page walks the grown-up through the sign-up โ whether you're setting this up for a kid or working through the book yourself. Budget about ten to twenty minutes, most of it waiting for confirmation emails.
Grown-ups: read this part first. ๐ Most cloud accounts ask for a credit card, and most of them can charge real money if a cluster gets left switched on. So:
- An adult should own the account and enter the card. Cloud providers require you to be an adult to sign up anyway. Expect a small temporary hold of about $1 while they check the card is real.
- Set a budget alert while you're signing up โ every provider on this page has one โ so you get an email long before anything surprising happens.
- Shut the cluster down when you're finished. This is the one that actually costs people money. See the tidying up checklist.
- Don't want to hand over a card at all? Start with Databricks Free Edition โ no card, nothing to remember to switch off, and no way to run up a bill.
- Already have cloud accounts through work? Then you may not need a trial at all โ ask whoever runs your data platform for a sandbox project or workspace and say it's for learning. That's a completely normal request and they get asked it constantly. Two things not to do: don't create anything in a production account, and don't put personal learning on a corporate card without checking your expense policy first.
Kids: here's your half of the job ๐งโ๐ The sign-up really does belong to the grown-up โ these companies only let adults open accounts, and there's usually a credit card involved. Everything after the sign-up is yours: making the notebook, setting it to Python, typing the code, running it. Read over their shoulder anyway, because you'll be the one who remembers where the buttons are next week. You also get the most important job on this page: at the end, you're the one who says "shut the cluster down." ๐
Which one should we pick? ๐ค
Holden has worked at or with Google Cloud, Amazon AWS, Microsoft Azure, IBM Cloud, Snowflake, and Databricks โ enough of them that there's no favourite left to have. All of them will run the code from this book, and all of them will tell you at length that their version is the fast one. The buttons live in different places and everybody uses slightly different words for the same things, but underneath it's the same Spark.
Two of those words are worth learning before you choose, because between them they decide almost everything about cost. A cluster is a pile of computers you rent by the second, and it keeps billing whether you're using it or not. Serverless means the provider switches computers on when you run something and stops charging when you stop. Wherever we get the choice below, we pick serverless.
| Provider | What the Spark bit is called | Card needed? | Good for us? |
|---|---|---|---|
| Databricks | Notebooks on "serverless" compute | No, on Free Edition | Easiest by a mile. Start here. |
| Google Cloud | Managed Service for Apache Spark (formerly Dataproc) | Yes, for the free trial | Very good; Colab is a nice shortcut |
| Amazon AWS | EMR โ EMR Serverless or EMR Studio | Yes | Powerful, most steps |
| Microsoft Azure | Fabric / Synapse Spark pools, Azure Databricks | Fabric trial needs no card; Azure itself does | Good if your family or your workplace is already on Microsoft 365 |
| IBM Cloud | watsonx.ai Studio notebooks on a Spark runtime | Card to sign up, but Lite plans never bill | Fine, with a small monthly allowance |
| Snowflake | Snowflake Notebooks + Snowpark | No, for the trial | Excellent tool; Snowpark is Spark-shaped, not Spark |
Fair warning about button names ๐ Cloud companies redesign their websites constantly โ often several times a year, and they rename the products even more often than that. The steps below describe what you're looking for and roughly where it lives, but if a button has moved or been renamed, that's the website changing, not you being lost. Searching the provider's own docs for the words in bold usually lands you in the right place.
๐งฑ Databricks
Databricks was started by the people who created Spark, and their free tier is the gentlest way to get a Spark notebook. No credit card, and no cluster to remember to turn off.
- Go to databricks.com/learn/free-edition and sign up for Databricks Free Edition. (Older books and blog posts talk about Community Edition. That was the previous free tier; it was retired in 2025 and Free Edition replaced it. They're not the same product and old logins don't work, so follow these steps rather than the old ones.)
- Confirm your email address and log in.
- In the left sidebar click New โ Notebook.
- Make sure the language selector at the top of the notebook says Python.
- Type
spark.range(1000000).filter("id % 7 == 0").count()into the first cell โ a cell is one of the boxes you type code into โ and press Shift+Enter, holding Shift and pressing Enter, which is how you tell a notebook "run this now."
The compute starts itself the first time you run a cell โ that can take a minute โ and
then you should see 142858.
Did you notice? โจ
You never typed SparkSession.builder. On Databricks the variable
spark already exists, ready to go, in every notebook. Most cloud notebooks
do this for you.
Free Edition is capped in size and idles itself out when you stop using it, which is exactly what we want โ there's no payment method attached, so it cannot bill you. Two things to expect: if you use up the daily allowance your compute stops until tomorrow, and when a notebook idles out it forgets its variables, so you re-run your cells. If you outgrow it, Databricks also offers a full trial that runs inside an AWS, Azure, or Google Cloud account โ that one can cost money, so read the tidying up section first.
๐ท Google Cloud
Google Cloud's Spark service is called Managed Service for Apache Spark. You'll also see it called Dataproc โ that's the older name, and it's still the word used in the command-line tool and in permission names, so don't be thrown when the branding and the commands disagree. New accounts get a free trial credit, and a card is required to prove you're a human. Google says it won't charge you when the trial ends unless you choose to upgrade.
- Sign up at cloud.google.com/free with a Google account.
- Create a project โ think of it as a labelled box that holds
everything you make. Call it something like
dc4k. - Set a budget alert: search the console โ Google's name for its control-panel website โ for Billing โ Budgets & alerts, and make a budget for a small amount like $5 so you get an email if something you forgot about is still running.
- Search the console's top search bar for Dataproc and enable the API when it asks.
- The friendliest option is the serverless flavour: choose to create an interactive session, or open BigQuery Studio and start a notebook with a Spark session attached. Serverless means there's no cluster sitting around costing money between uses.
- If you'd rather have a classic cluster, use Create cluster, pick a
small 2-vCPU machine type such as
e2-standard-2(the very smallest "shared core" types likee2-microaren't allowed here, so don't waste time trying them), tick Jupyter under optional components, and โ importantly โ set scheduled deletion so the cluster switches itself off after an hour or two of idleness.
The five-minute shortcut ๐ Google Colab is free, needs only a Google account, and gives you a Python notebook in your browser. Put this in the first cell, all together, and run it before importing anything:
!apt-get -qq install -y openjdk-17-jdk-headless
!pip install -q "pyspark[sql]==4.2.*"
import os
os.environ["JAVA_HOME"] = "/usr/lib/jvm/java-17-openjdk-amd64"
Then you can do every exercise in the book on Colab's single machine โ the same as installing Spark on your own computer, but with nothing to install. It's not a real cluster, but the code is identical.
Spark needs Java, and it needs to be told where Java is, which is what that
JAVA_HOME line does. Both lines are required, not just-in-case. If you set it
after already importing PySpark, use Runtime โ Restart session and run the cell
again.
๐ฆ Amazon AWS
Amazon's Spark service is EMR โ Elastic MapReduce, named after Hadoop MapReduce, the older idea Spark was invented to improve on. AWS has the most steps of any provider here. EMR has no permanently-free tier of its own, but new AWS accounts come with sign-up credits that EMR usage can draw on. Keep an eye on the meter either way.
- Sign up at aws.amazon.com/free. You'll need a card and a phone number.
- Turn on a budget straight away: search for Billing and Cost Management โ Budgets, and create a small monthly budget with an email alert.
- Pick a region in the top-right corner โ somewhere near you โ and stick with it. Things you make in one region are invisible in the others, which confuses absolutely everybody at least once.
- Search for EMR, then choose EMR Serverless and create an application with the Spark option. Two settings matter before you click Create: tick the box that enables interactive use (it's off by default, and without it the notebook step below has nothing to attach to), and leave the "pre-initialized capacity" setting alone โ that option keeps machines warm and ready, which also means it keeps them billing. Serverless is the right choice for us: it bills for the time your work is actually running rather than for a cluster sitting idle.
- For a notebook, open EMR Studio and create a Workspace, then attach it to your serverless application. Alternatively, AWS Glue interactive sessions give you real PySpark with less clicking.
- Some steps ask you to create an IAM role or an S3 bucket. Accept the defaults it offers โ those are the permission slip and the storage locker, and AWS will make sensible ones for you.
Watch out for classic clusters โ ๏ธ If you create a classic EMR cluster rather than serverless, it charges for every second it exists, whether or not you're using it โ an idle cluster left on overnight is a real bill. Terminate it the moment you're done, and check back the next day to be sure it's really gone.
๐ฆ Microsoft Azure
Azure has more than one Spark: Microsoft Fabric (the current recommendation, with Spark notebooks built in), Azure Synapse Analytics Spark pools, and Azure Databricks, which is Databricks living inside Azure.
- The quickest path is Microsoft Fabric: sign in with a Microsoft account and start the Fabric trial. The trial doesn't need a credit card. It usually does need a work or school email address, not a personal Outlook or Hotmail one. So: if you have a work or school email, this is the fastest card-free path on the page. If you don't, it's worth asking a parent or helper whether they can sign up through their workplace โ and if nobody has one, use Databricks Free Edition instead.
- In Fabric, create a workspace, then inside it create a
Notebook. Fabric notebooks are PySpark notebooks with
sparkalready defined, so runspark.range(1000000).filter("id % 7 == 0").count()and you're off. - Good news on safety: Azure free accounts come with a real spending limit switched on by default, equal to your trial credit. Leave it on. Under Cost Management + Billing you can check it's on and add a budget email alert โ but note that budgets only send warnings, while the spending limit is the thing that actually stops the meter. You can't set a custom amount; it's fixed at the credit.
- Want Azure Databricks instead? Be aware this is a bigger commitment than the Fabric trial: its free trial won't run on a free-trial subscription, so you have to convert to pay-as-you-go and give up that spending limit first. If you're going to do that, set a budget alert before you create anything, and read the tidying up section. For learning the book, Databricks Free Edition gets you the same notebook with none of this.
๐ต IBM Cloud
IBM's notebook environment is part of watsonx.ai Studio โ you'll see it called Watson Studio in anything written before late 2024. IBM's free "Lite" plans genuinely never bill you, but IBM Cloud does ask for a credit card when you create the account, purely to check you're a real person.
- Sign up at cloud.ibm.com/registration and verify your email.
- From the catalog, add watsonx.ai Studio and choose the Lite plan. Lite plans are free and simply stop when you've used up the month's allowance โ they don't bill you. The allowance is about ten hours of compute a month, which is plenty for working through chapters but not for leaving things running.
- Create a project, which is IBM's box for holding notebooks and data. Some projects ask you to associate a Cloud Object Storage instance; pick the Lite plan for that too.
- In the project, add a new asset of type Notebook. When it asks you to choose a runtime โ that's the kind and size of computer your code will run on โ pick one whose name includes Spark, for example "Default Spark 4.0 & Python 3.11". On Lite you get two executors, which is a small but genuine cluster.
- IBM doesn't reliably hand you a ready-made
sparkvariable, so start the notebook with the explicit version โ it's correct everywhere:from pyspark.sql import SparkSession spark = SparkSession.builder.appName("dc4k").getOrCreate() spark.range(1000000).filter("id % 7 == 0").count()
Skip IBM Analytics Engine ๐ Older guides โ and IBM's own marketing pages, which haven't caught up โ point you at IBM Analytics Engine for Spark clusters. Don't bother: IBM stopped allowing new instances in May 2026 and is retiring it in 2027. The notebook route above is the way in now.
Lite runtimes stop your notebook once it's been idle a while. Mildly annoying mid-exercise; excellent for the family bank account, since nothing can quietly run up a bill while you're at school.
โ๏ธ Snowflake
Snowflake gives you a 30-day trial with a chunk of free credits and no credit card, and it has notebooks built in. One thing to know up front: Snowflake's own DataFrame library is called Snowpark. It was deliberately designed to look like Spark, so most of the code in this book reads the same โ but it isn't literally Spark, so a few things are spelled differently.
- Sign up at signup.snowflake.com. Any cloud provider and region will do. (If you let the trial lapse and want it back later, reactivating it does need a card โ so use it while it's fresh.)
- Log into Snowsight, the web interface, and go to Projects โ Workspaces, then create a notebook there. Plenty of guides still say Projects โ Notebooks; that was the older layout, and new accounts can't use it, so Workspaces is the one to look for.
- Notebooks run on Snowflake's own compute, and only reach for a warehouse when you run SQL or Snowpark โ which our example does, so pick the smallest one offered (X-Small). A Snowflake warehouse is its word for the cluster doing the work: confusingly, it means the computers, not the data they're working on, which trips up nearly everyone who has heard "data warehouse" used the other way. It auto-suspends when you stop using it, which keeps the trial credits from evaporating.
- To use Snowpark, start your notebook with:
You should getfrom snowflake.snowpark.context import get_active_session session = get_active_session() session.range(1000000).filter("id % 7 = 0").count()142858, same as everywhere else. Note the single=: that's SQL's way of saying "equals", where Python wants==. - If you'd rather run genuine PySpark code against Snowflake, look up Snowpark Connect for Apache Spark in their docs โ it accepts real Spark DataFrame code and runs it on Snowflake's engine. It targets the Spark 3.5 API rather than the 4.2 we use, and it leaves out the older RDD API, streaming, and MLlib, so treat it as a very good translation rather than a perfect one.
Our suggestion ๐ก Snowflake is a great thing to have seen, but if this is your first cluster and you want the book's examples to match character-for-character, start with Databricks Free Edition and come back to Snowflake afterwards.
Does it work? The same test everywhere ๐งช
Whichever provider you picked, run this in the first cell of the notebook:
spark.range(1000000).filter("id % 7 == 0").count()
If the answer is 142858, you have a working Spark cluster and you're ready
for the book. ๐ (Why that number? There are 142,857 multiples of seven under a million โ
142857 ร 7 = 999999 โ plus zero, which counts too.)
If it complains that spark is undefined, the notebook probably isn't a Spark
notebook โ or it's still starting up. Try adding this above it:
from pyspark.sql import SparkSession
spark = SparkSession.builder.appName("dc4k").getOrCreate()
If that fails too, the notebook is a plain Python notebook. Either pick a Spark runtime when you create the notebook, or use the Colab recipe above โ installing PySpark and pointing it at a Java โ which gives you a one-machine Spark, plenty for the exercises.
Tidying up โ the important bit ๐งน
Cloud computers keep charging while they're switched on, even if nobody is looking at them. Make this a habit at the end of every session:
- Databricks Free Edition, IBM Lite, Snowflake trial, Colab, Fabric trial: nothing to do. They stop themselves and can't bill you.
- Any cluster you created by hand โ a Dataproc cluster, EMR cluster, Synapse pool, or Databricks trial cluster โ needs to be deleted or terminated. Not "stop the notebook": the cluster itself.
- Check the bill the next day. Open the billing page and look at the current month's charges. If it says a few cents, or nothing, you're fine. For scale: doing the book's exercises on a serverless option costs pennies per session, a small cluster left switched on by mistake is a few dollars a day, and a big one can be a few hundred. That gap โ between what you actually used and what you forgot to turn off โ is where essentially every surprising cloud bill comes from. This thirty-second check is how you catch it before it matters.
- Serverless options (serverless Dataproc, EMR Serverless, Databricks serverless) only bill while something is actually running, which is exactly why we recommended them. There are, of course, servers. "Serverless" means somebody else has to remember to switch them off โ which is the part we care about.
- Done for good? Close the account, or at least remove the payment method. Every provider on this page lets you do that from the billing page.
When things go wrong ๐ง
- The sign-up won't accept the credit card
- Providers usually put a small temporary hold (about $1) on the card to check it's real, and some prepaid and virtual cards get rejected for this. Try a different card, or use one of the genuinely card-free options: Databricks Free Edition, Snowflake's trial, or the Fabric trial if you have a work or school email. (IBM's Lite plans never bill you, but IBM still wants a card at sign-up, so it's not a way around this one.)
- "Quota exceeded" or "insufficient capacity" when starting a cluster
- New accounts start with low limits, and a region can genuinely be full. Ask for a smaller cluster (fewer machines, smaller machine type), or switch to a different region. Both are normal, and neither is your fault.
- The cluster takes ages to start
- Five minutes is normal for a real cluster โ the provider is finding computers for you, switching them on, and installing Spark on each one. Serverless options usually start in under a minute.
- A permissions or "access denied" error
- Cloud accounts are strict about who is allowed to do what, and the person who made the account has to grant permissions to everybody else โ including, sometimes, to themselves. Sign in as the account owner and accept the default role the wizard offers.
- The button in the instructions isn't there
- Very likely the product was renamed or the page was redesigned โ it happens constantly, and this page names three renames already. Search the provider's own docs for the bold words in the step rather than hunting the menus.
- The notebook can't find your data file
- Cloud clusters can't see the files on your laptop. Upload the file to the provider's storage first (S3, Cloud Storage, ADLS, Cloud Object Storage, or the notebook's own file browser), and use the path it gives you.
- We got a bill! ๐ฑ
- It happens, and it's usually a forgotten cluster. Delete anything still running, then contact the provider's support โ all of these companies have a history of forgiving first-time accidental charges, especially for people who are learning.
- This is all too much
- Completely reasonable. Try the Colab recipe, which is the shortest path to a working notebook on this whole page, or install Spark on your own computer. The book works fine on one machine โ a cluster just makes it more exciting.