Hiring Partners
Segilola Resources Operating LimitedTaviatech TechnologiesFCMBMTN NigeriaAdvans La Fayette Microfinance BankAboki AfricaFirst Bank of NigeriaOPay
← Big Data Engineering WIth Spark · Lesson 6 of 9

Module Five

📖 Every lesson in this course is free to read right here, no account needed. Create a free account to track your progress, take the exam, and earn your certificate.
6
Module 5 – Spark in the Cloud

☁️ Module 5 – Spark in the Cloud

Module Introduction

Hello, cloud explorer! 🌤️ In Module 4, we learned how Spark helps us process big data fast. But where do we run Spark? We run it on computers. What if we don't have big computers at home? That's where the cloud comes in!

The cloud is like a giant playground of computers that belong to someone else, but we can rent them whenever we want. It's like borrowing your friend's super-powerful gaming computer to play a big game, but you only pay for the time you use it.

In this module, we will learn how to run Spark on the cloud. We will use services like AWS, Azure, and Google Cloud. We will also learn how to set up clusters, manage resources, and make our Spark jobs run even faster. Let's fly into the cloud! 🚀

Learning Objectives

By the end of this module, you will be able to:

  • Explain what cloud computing is and why it is useful.
  • Identify the major cloud providers: AWS, Azure, and Google Cloud.
  • Understand how to run Spark on the cloud.
  • Set up a Spark cluster on AWS using EMR.
  • Use S3 to store and read data in the cloud.
  • Scale your Spark jobs to handle more data.
  • Monitor and manage your Spark jobs on the cloud.
  • Understand costs and how to save money.

Warm‑up Story – The School Playground

Imagine your school has a small playground with just one slide and one swing. When only a few children play, it's fine. But one day, the whole school wants to play at the same time! The playground is too small.

The principal says, "Don't worry! We can use the big playground at the community centre. It has 10 slides, 20 swings, and lots of space. We can rent it for just one day, and we only pay for that day."

That is exactly what cloud computing is! Instead of buying our own big computers (which are expensive and we may not need them every day), we rent them from cloud providers. We pay only for what we use, and we can get as many computers as we need.

   Your small computer (at home)
          |
          |  not enough power
          V
   Cloud playground (big computers)
   +-------------------------------+
   |  Computer 1   Computer 2     |
   |  Computer 3   Computer 4     |
   |  ... (hundreds of computers)  |
   +-------------------------------+
   You rent them for a few hours.

🌟 Mini summary: The cloud is like a playground of computers that we can rent when we need them. We pay only for what we use.


Main Lessons

Lesson 1: What is Cloud Computing?

Definition: Cloud computing means using computers, storage, and services over the internet, instead of owning them yourself.

Why it is important: The cloud gives us access to powerful computers without buying them. We can scale up or down easily.

Simple explanation: It's like using a library instead of buying all the books yourself. You borrow what you need and return it when done.

Real-life example: Netflix uses the cloud to stream movies to millions of people.

School example: Your school uses Google Classroom – that's cloud computing!

Home example: You use iCloud or Google Photos to store your pictures.

Nigerian example: Many Nigerian startups use the cloud to run their apps without buying expensive servers.

   Traditional: Buy computer → Install software → Run
   Cloud:       Rent computer over internet → Run → Stop paying

📌 Mini summary: Cloud computing means renting computers and services over the internet instead of buying them.


Lesson 2: The Three Big Cloud Providers

Definition: The three biggest cloud companies are Amazon Web Services (AWS), Microsoft Azure, and Google Cloud Platform (GCP).

Why it is important: These companies have the biggest and most reliable clouds. Most people use one of them.

Simple explanation: They are like the three biggest supermarkets for computers. You can go to any one to buy (rent) computer power.

Real-life example: Spotify uses Google Cloud. Airbnb uses AWS. Many banks use Azure.

School example: Your school might use Microsoft Office 365 (Azure) or Google Workspace (GCP).

Home example: If you use Amazon Prime Video, that's AWS.

Nigerian example: Flutterwave uses AWS for its payment processing.

   +----------+   +----------+   +----------+
   |   AWS    |   |  Azure   |   |   GCP    |
   | (Amazon) |   | (Microsoft) | (Google)  |
   +----------+   +----------+   +----------+
   All three offer Spark in the cloud!

📌 Mini summary: AWS, Azure, and GCP are the three big cloud providers. They all offer Spark.


Lesson 3: Why Run Spark in the Cloud?

Definition: Running Spark in the cloud means you run your Spark jobs on rented computers that are managed by a cloud provider.

Why it is important: You don't need to buy expensive hardware. You can get thousands of computers for a short time.

Simple explanation: It's like having a magic button that gives you more computers when you need them.

Real-life example: A company runs a big sale and needs extra computer power for one day. They rent it from the cloud.

School example: During exam grading, your school rents cloud computers to process all the results quickly.

Home example: If your family wants to store a million photos, they use cloud storage.

Nigerian example: During elections, cloud computers can count voting data from all over the country.

   Reasons to use cloud for Spark:
   1. No need to buy hardware 💰
   2. Scale up or down easily 📈
   3. Pay only for what you use ⏱️
   4. Use the latest machines 🆕
   5. Focus on your code, not on setup 🧑‍💻

📌 Mini summary: The cloud makes Spark easy and affordable because you rent computers only when you need them.


Lesson 4: Amazon Web Services (AWS) Overview

Definition: AWS is Amazon's cloud platform. It is the most popular cloud provider in the world.

Why it is important: AWS has many services for big data, including EMR (Elastic MapReduce) which runs Spark.

Simple explanation: AWS is like a huge toy store with many different toys (services). One of the toys is Spark.

Real-life example: Netflix, Airbnb, and many others use AWS.

School example: If your school uses Amazon, they might use AWS for their website.

Home example: Amazon Prime Video runs on AWS.

Nigerian example: Paystack (owned by Stripe) uses AWS for payment processing.

   AWS Services for Big Data:
   +------------------+
   |  EMR (Spark)    |  ← we will use this!
   |  S3 (storage)   |  ← store our data
   |  EC2 (computers) |  ← virtual machines
   |  Lambda (serverless) |
   +------------------+

📌 Mini summary: AWS is Amazon's cloud. We use EMR to run Spark and S3 to store data.


Lesson 5: S3 – Simple Storage Service

Definition: S3 is a service in AWS that stores files in the cloud. Think of it as a very big online folder.

Why it is important: S3 can store any amount of data. Spark can read data directly from S3.

Simple explanation: It's like Google Drive but made for big data. You can put any file there, and Spark can read it.

Real-life example: Companies store all their customer data in S3.

School example: Your teacher stores all assignments in a shared folder (like S3).

Home example: You save your homework in Google Drive – S3 is similar but more powerful.

Nigerian example: A bank stores all transaction logs in S3.

   Data Flow:
   Your computer → upload to S3 → Spark reads from S3 → results saved to S3

📌 Mini summary: S3 is cloud storage for files. Spark can read and write data to S3.


Lesson 6: EMR – Elastic MapReduce

Definition: EMR is an AWS service that makes it easy to run Spark and other big data tools in the cloud.

Why it is important: EMR sets up all the Spark clusters for you automatically. You just tell it what to do.

Simple explanation: EMR is like a magical machine that creates Spark clusters with a single click. No need to set up anything yourself.

Real-life example: A data scientist uses EMR to run a Spark job on 100 computers in 5 minutes.

School example: The principal clicks a button and suddenly 20 computers are ready for the students.

Home example: Like ordering a pizza – you click, and it arrives ready.

Nigerian example: A startup uses EMR to process customer data every night.

   How EMR works:
   1. You tell EMR what you need (Spark, number of computers, etc.)
   2. EMR creates the cluster automatically
   3. You run your Spark job
   4. EMR shuts everything down when done (optional)

📌 Mini summary: EMR is a service that creates and manages Spark clusters in the cloud for you.


Lesson 7: Azure Synapse and Databricks

Definition: Azure has a service called Synapse that can run Spark. Databricks is a company that makes Spark easy on all clouds.

Why it is important: You don't have to use AWS – you can use Azure or Databricks too.

Simple explanation: It's like having different brands of cars – all can take you to the same place (Spark), but each has its own style.

Real-life example: Many companies use Databricks because it has a nice web interface.

School example: Your school might use different software for different subjects.

Home example: You can use different apps to watch movies.

Nigerian example: A Nigerian company might choose Azure because they already use Microsoft products.

   Cloud Spark Options:
   +----------+   +----------+   +----------+
   | AWS EMR  |   | Azure    |   | Google   |
   |          |   | Synapse  |   | Dataproc |
   +----------+   +----------+   +----------+
        |               |               |
        +---------------+---------------+
                        |
                        V
                +-------------+
                | Databricks  | (works on all clouds)
                +-------------+

📌 Mini summary: You can run Spark on AWS, Azure, or Google Cloud. Databricks is a popular tool that works on all of them.


Lesson 8: Setting Up a Cluster on EMR

Definition: A cluster is a group of computers that work together. Setting up a cluster means creating those computers.

Why it is important: Without a cluster, you can't run Spark in parallel. You need many workers.

Simple explanation: It's like forming a team. You need to gather the players before you can play the game.

Real-life example: Before a big project, the manager forms a team of workers.

School example: The teacher divides the class into groups before the activity.

Home example: Before cleaning the house, you ask everyone to help.

Nigerian example: Before the village harvest, the chief calls all the farmers together.

   Steps to create an EMR cluster:
   1. Go to AWS Management Console
   2. Click on EMR
   3. Click "Create Cluster"
   4. Choose Spark as the application
   5. Choose number of nodes (computers)
   6. Click "Create" – wait 5 minutes
   7. Your cluster is ready! 🎉

📌 Mini summary: Creating a cluster on EMR is easy – you click a few buttons and wait a few minutes.


Lesson 9: Reading Data from S3

Definition: Reading data from S3 means your Spark code can load files directly from S3 storage.

Why it is important: Your data is in S3, so Spark needs to read it from there.

Simple explanation: It's like reading a book from the library – you need to go to the library first.

Real-life example: A company stores all sales data in S3. Spark reads it to analyse sales.

School example: The teacher stores all homework in a cloud folder. Students read from there.

Home example: You read recipes from an online cookbook.

Nigerian example: A farmer stores crop data in S3. Spark reads it to predict harvest.

   Spark code to read from S3:
   df = spark.read.csv("s3://my-bucket/sales_data.csv")
   or
   df = spark.read.parquet("s3://my-bucket/customers/")
   S3 path format: s3://bucket-name/folder/file

📌 Mini summary: Spark can read files from S3 using paths that start with "s3://".


Lesson 10: Writing Results to S3

Definition: Writing results to S3 means saving your Spark output to S3 storage.

Why it is important: You want to keep your results for later. S3 is a safe place to store them.

Simple explanation: After you finish your drawing, you put it in your folder so you don't lose it.

Real-life example: After running a report, the company saves it to S3 for other teams to use.

School example: After the class project, the teacher saves it to the school's cloud folder.

Home example: After you finish your homework, you save it to your computer.

Nigerian example: After counting votes, the result is saved to S3 for everyone to see.

   Spark code to write to S3:
   result_df.write.csv("s3://my-bucket/output/results.csv")
   or
   result_df.write.parquet("s3://my-bucket/output/")
   You can also save as JSON, ORC, etc.

📌 Mini summary: Spark can save results to S3 using the write() method.


Lesson 11: Scaling Your Spark Jobs

Definition: Scaling means using more or fewer computers to do the work.

Why it is important: Sometimes you need more power (more computers) to finish fast. Other times you want fewer computers to save money.

Simple explanation: It's like adding more people to help you move a heavy sofa. More people = faster, but you have to pay them.

Real-life example: During Black Friday, an online store uses 10 times more computers to handle all the orders.

School example: For a big exam, the school uses more teachers to mark papers.

Home example: When cleaning the house, more family members help to finish quickly.

Nigerian example: During elections, INEC uses more computers to count votes quickly.

   Scaling options:
   +------------------+------------------+
   | Vertical Scaling | Horizontal Scaling |
   | (make one bigger) | (add more workers) |
   +------------------+------------------+
   | Use a bigger     | Use 10 computers   |
   | computer         | instead of 1       |
   +------------------+------------------+
   In the cloud, horizontal scaling is easier!

📌 Mini summary: Scaling means adding or removing computers to match your needs.


Lesson 12: Monitoring Your Cloud Spark Jobs

Definition: Monitoring means watching your Spark job while it runs to see if everything is going well.

Why it is important: You want to know if your job is making progress, using enough memory, or if it has errors.

Simple explanation: It's like watching the cooker to see if your food is cooking properly.

Real-life example: A driver uses a speedometer to monitor the car's speed.

School example: The teacher walks around the class to monitor students' work.

Home example: Mum checks the oven to see if the cake is ready.

Nigerian example: A bus conductor monitors how many passengers are on the bus.

   Monitoring tools:
   1. EMR Console (shows cluster status)
   2. Spark UI (shows job progress)
   3. CloudWatch (shows logs and metrics)
   4. Ganglia (shows resource usage)
   You can see:
   - How much memory is used
   - How many tasks are running
   - If any tasks failed

📌 Mini summary: Monitoring helps you see if your Spark job is running correctly.


Lesson 13: Managing Costs in the Cloud

Definition: Cost management means using the cloud in a way that doesn't waste money.

Why it is important: Cloud services cost money per hour. If you leave computers running, you pay even if you're not using them.

Simple explanation: It's like leaving all the lights on in your house – you pay for electricity you don't need.

Real-life example: A company shuts down its cloud computers at night to save money.

School example: The teacher turns off the projector when not in use.

Home example: You switch off the TV when no one is watching.

Nigerian example: A small business uses cloud computers only during business hours to save money.

   Ways to save money:
   1. ✅ Shut down clusters when not in use
   2. ✅ Use spot instances (cheaper)
   3. ✅ Choose smaller machines if you don't need big ones
   4. ✅ Use auto-scaling (add computers only when needed)
   5. ❌ Don't leave clusters running overnight (unless you need to)

📌 Mini summary: To save money, turn off cloud computers when you don't need them.


Lesson 14: Cloud-Native Spark – Serverless

Definition: Serverless means you don't manage servers at all. You just submit your Spark job and it runs somewhere.

Why it is important: It makes Spark even easier. You don't need to create clusters or manage anything.

Simple explanation: It's like using a vending machine – you put in your request (code) and get the result (output). You don't care about how the machine works inside.

Real-life example: AWS Glue is a serverless Spark service. You just write your ETL jobs and they run.

School example: The canteen gives you food – you don't need to know how it's cooked.

Home example: You use a microwave – you don't know how it works inside.

Nigerian example: A payment app like Opay processes transactions – you don't see the servers.

   Serverless vs Traditional:
   Traditional: You manage cluster, software, updates
   Serverless:  You just submit code – the cloud handles everything
   +------------------+------------------+
   | Traditional      | Serverless       |
   | (EMR)            | (Glue, Databricks) |
   +------------------+------------------+

📌 Mini summary: Serverless Spark means you don't manage any servers – just submit your code.


Lesson 15: Putting It All Together – A Cloud Spark Workflow

Here is how a typical cloud Spark workflow looks:

   1. Prepare your data → upload to S3
   2. Write your Spark code (Python/Scala)
   3. Create an EMR cluster (or use serverless)
   4. Submit your job to the cluster
   5. Monitor progress via Spark UI
   6. Results are saved to S3
   7. Shut down the cluster (to save money!)
   8. Download results from S3 (if needed)

Let's see a simple example in Python using PySpark on EMR:

   from pyspark.sql import SparkSession
   spark = SparkSession.builder.appName("Cloud Word Count").getOrCreate()
   # Read from S3
   df = spark.read.text("s3://my-bucket/story.txt")
   # Process
   words = df.rdd.flatMap(lambda line: line[0].split(" "))
   word_counts = words.map(lambda w: (w, 1)).reduceByKey(lambda a,b: a+b)
   # Save to S3
   word_counts.toDF(["word", "count"]).write.csv("s3://my-bucket/output/")
   spark.stop()

📌 Mini summary: Cloud Spark workflow: upload data → write code → create cluster → run → save results → shut down.


Key Vocabulary (with simple definitions)

  • Cloud: Computers and services you use over the internet.
  • Cloud Provider: A company that offers cloud services (AWS, Azure, GCP).
  • AWS: Amazon Web Services – the most popular cloud provider.
  • S3: Simple Storage Service – AWS's cloud storage.
  • EMR: Elastic MapReduce – AWS service for running Spark.
  • Cluster: A group of computers that work together.
  • Node: One computer in a cluster.
  • Scale: To add or remove computers.
  • Serverless: You don't manage servers – the cloud does everything.
  • Cost Management: Using the cloud without wasting money.
  • Monitoring: Watching your job to see if it's working.
  • Spot Instance: Cheaper computers that might be taken away.
  • Auto-scaling: Automatically adding/removing computers based on workload.
  • Glue: AWS's serverless Spark service.
  • Databricks: A company that makes cloud Spark easy.

Important Concepts

  1. Pay-as-you-go: You pay only for what you use, like electricity.
  2. Elasticity: The ability to grow or shrink resources as needed.
  3. Region: A physical location where the cloud has servers (e.g., us-east-1).
  4. Availability Zone: A specific building within a region.
  5. IAM: Identity and Access Management – controls who can do what in AWS.
  6. VPC: Virtual Private Cloud – your own private network in the cloud.

Step‑by‑Step Explanations

How to run a Spark job on EMR:

  1. Sign in to AWS Console.
  2. Navigate to EMR service.
  3. Click "Create cluster".
  4. Select "Spark" as the application.
  5. Choose the number of nodes (e.g., 1 master, 2 core).
  6. Choose the instance type (e.g., m5.xlarge).
  7. Click "Create cluster" and wait (about 5 minutes).
  8. Once running, click "Steps" → "Add step".
  9. Choose "Spark application".
  10. Point to your Python script in S3.
  11. Click "Add" and the job will run.
  12. Monitor progress in the Spark UI.
  13. When done, check output in S3.
  14. Terminate the cluster to stop paying.
   Step 1:  AWS Console → EMR
   Step 2:  Create Cluster
   Step 3:  Add Step (your Spark code)
   Step 4:  Run Job
   Step 5:  Check Output
   Step 6:  Terminate Cluster 💰

Real‑life Examples

  • E‑commerce: Amazon runs Spark on EMR to analyse customer behaviour during Prime Day.
  • Finance: A bank uses Spark on Azure to detect fraudulent transactions in real time.
  • Healthcare: A hospital uses Spark on GCP to analyse patient records and predict outbreaks.
  • Media: Netflix uses Spark on AWS to recommend movies to users.

Nigerian Examples

  • Flutterwave: Uses AWS EMR to process millions of transactions daily.
  • Jumia: Uses AWS to run Spark jobs that analyse customer purchases.
  • Kuda Bank: Uses cloud Spark to detect fraud and manage risk.
  • Nigerian Government: Could use AWS to analyse census data.
  • Agriculture: A startup uses cloud Spark to analyse farm data from all over Nigeria.

Fun Examples Children Can Relate To

  • Lego playdate: You invite friends over to build a big Lego castle. More friends = faster building. That's scaling!
  • Homework help: You ask 5 friends to help with homework – it finishes faster.
  • Video game: In Minecraft, you can add more players to help build your world.
  • Party planning: More people helping = party ready faster.

Everyday Examples

  • Grocery shopping: More family members = faster shopping.
  • Cleaning: More people cleaning = house clean faster.
  • Moving house: More movers = move completed quicker.
  • Queueing: More cashiers = shorter queues.

Teacher Notes

  • Emphasise the "rental" analogy for cloud computing.
  • Use diagrams to show the difference between on‑premise and cloud.
  • Walk through an EMR cluster creation step‑by‑step (if possible, show a live demo).
  • Discuss cost awareness – highlight that cloud resources are not free.
  • Encourage students to think about when they would use the cloud.

Parent Tips

  • Discuss how you use the cloud in your daily life (e.g., Gmail, Google Drive, iCloud).
  • Talk about the cost of cloud services – it's like paying for electricity or water.
  • Encourage your child to compare cloud providers (AWS, Azure, GCP).
  • Watch a video about cloud data centres together.

Interesting Facts

  • AWS started in 2006 and now has millions of customers.
  • The cloud is so big that data centres are like cities with their own power plants.
  • Some cloud data centres use special cooling systems because computers get very hot.
  • Many cloud providers use renewable energy to power their data centres.
  • Azure uses underwater data centres to save energy!
  • Google Cloud has a data centre in Nigeria (Lagos) to serve African customers better.

Did You Know?

  • 🤔 Did you know that the cloud is actually physical computers in buildings called data centres?
  • 🤔 Did you know that AWS has more than 200 different services?
  • 🤔 Did you know that you can run Spark on the cloud for less than ₦500 per hour?
  • 🤔 Did you know that some cloud providers have free tiers so you can try them without paying?
  • 🤔 Did you know that the cloud is used by 90% of all companies in the world?

Remember This

  • The cloud is like renting computers over the internet.
  • Three big cloud providers: AWS, Azure, Google Cloud.
  • AWS EMR is a service that runs Spark in the cloud.
  • S3 is cloud storage – Spark can read and write to S3.
  • Scaling means adding or removing computers.
  • Serverless means you don't manage servers.
  • Always shut down clusters to save money.
  • Monitor your jobs to catch problems early.

Common Mistakes

  • ❌ Forgetting to terminate the cluster – you keep paying!
  • ❌ Using too many large machines – wastes money.
  • ❌ Not checking the Spark UI – you don't see errors.
  • ❌ Using wrong S3 path – job fails.
  • ❌ Not setting permissions (IAM) – cannot access S3.
  • ❌ Forgetting to install extra libraries on the cluster.

Best Practices

  • ✅ Use spot instances for non‑critical jobs to save money.
  • ✅ Terminate clusters immediately after the job finishes.
  • ✅ Use auto‑scaling to adjust resources automatically.
  • ✅ Store input and output in S3 (not on the cluster).
  • ✅ Use CloudWatch for monitoring and alerts.
  • ✅ Test with a small dataset before running on full data.
  • ✅ Use the right instance type (e.g., memory‑optimised for big joins).

ASCII Illustrations

Cloud Architecture (simple):

   +-------------+
   |  Your Laptop|
   +-------------+
         |
         | (submit job)
         V
   +---------------------------------+
   |         AWS CLOUD               |
   |  +---------------------------+  |
   |  |   EMR Cluster             |  |
   |  |  +------+ +------+       |  |
   |  |  |Master| |Worker|       |  |
   |  |  +------+ +------+       |  |
   |  |  |Worker| |Worker|       |  |
   |  |  +------+ +------+       |  |
   |  +---------------------------+  |
   |  +---------------------------+  |
   |  |   S3 Storage              |  |
   |  |  (data in, data out)      |  |
   |  +---------------------------+  |
   +---------------------------------+
         |
         V
   Results saved to S3

Scaling Up vs Scaling Out:

   Scaling Up (Vertical):
   [Small computer] → [Bigger computer]
   (one computer, more powerful)

   Scaling Out (Horizontal):
   [1 computer] → [10 computers]
   (more computers, each does a small part)

Cost vs Time Trade‑off:

   +------------------+------------------+
   | Number of Nodes  | Time to Finish   |
   +------------------+------------------+
   | 1 node           | 10 hours         |
   | 5 nodes          | 2 hours          |
   | 10 nodes         | 1 hour           |
   | 20 nodes         | 30 minutes       |
   +------------------+------------------+
   More nodes = faster, but more expensive.

Comparison Tables

On‑Premise vs Cloud:

FeatureOn‑PremiseCloud
CostHigh upfrontPay as you go
ScalingHard and slowEasy and fast
MaintenanceYou do itProvider does it
Setup timeWeeksMinutes
AccessibilityOn‑site onlyFrom anywhere

AWS vs Azure vs GCP:

FeatureAWSAzureGCP
Spark serviceEMRSynapseDataproc
StorageS3BlobCloud Storage
Popularity#1#2#3
Free tierYesYesYes
Serverless SparkGlueSynapseDataproc Serverless

EMR Instance Types:

TypeUse caseCost
m5.xlargeGeneral purposeMedium
r5.xlargeMemory‑intensiveHigher
c5.xlargeCompute‑intensiveMedium
spot instancesNon‑critical jobsVery low

End‑of‑Module Summary

Congratulations! 🎉 You have completed Module 5 – Spark in the Cloud. Here is what we learned:

  • Cloud computing means renting computers over the internet.
  • The three big cloud providers are AWS, Azure, and Google Cloud.
  • Running Spark in the cloud is easy, scalable, and cost‑effective.
  • AWS EMR is a service that runs Spark clusters.
  • S3 is cloud storage where we store data for Spark to read.
  • We can scale our clusters up or down based on need.
  • Monitoring helps us track job progress.
  • We must manage costs by shutting down clusters when not in use.
  • Serverless options like Glue make Spark even easier.

You are now ready for Module 6 – Real‑World Spark Projects! 🚀

Frequently Asked Questions (FAQs)

  1. Q: Is the cloud safe? A: Yes, cloud providers have strong security. They are often safer than your own computer.
  2. Q: How much does cloud Spark cost? A: It depends on the size of the cluster and how long you run it. It can be as low as ₦500 per hour.
  3. Q: Which cloud provider should I choose? A: Any of the three big ones (AWS, Azure, GCP) is fine. Start with the one you have access to.
  4. Q: Can I use the cloud for free? A: Yes, all providers have a free tier with limited resources.
  5. Q: Do I need to manage the cloud servers? A: With EMR and serverless, the provider manages everything for you.
  6. Q: What is an S3 bucket? A: A bucket is like a folder in S3. You put your files in buckets.
  7. Q: How do I access my S3 data from Spark? A: Use the path s3://bucket-name/folder/file.
  8. Q: What happens if I forget to shut down my cluster? A: You will keep paying for it. Always set auto‑termination or a timeout.
  9. Q: Can I run Spark on the cloud without EMR? A: Yes, you can install Spark on EC2, but EMR is easier.
  10. Q: What is the difference between EMR and Glue? A: EMR is a managed cluster; Glue is serverless (no cluster to manage).

Review Questions

  1. What is cloud computing?
  2. Name the three big cloud providers.
  3. What does AWS stand for?
  4. What is S3 used for?
  5. What is EMR used for?
  6. How do you read data from S3 in Spark?
  7. What is scaling?
  8. What is serverless computing?
  9. Why should you terminate your cluster after use?
  10. What is a spot instance?
  11. How can you monitor your Spark job on EMR?
  12. What is the difference between AWS, Azure, and GCP?
  13. What is an S3 bucket?
  14. What is auto‑scaling?
  15. What are the benefits of running Spark in the cloud?

Fill‑in‑the‑Blank Exercises

  1. Cloud computing means using computers over the __________ (internet / intranet).
  2. AWS stands for __________ Web Services.
  3. S3 is a __________ (storage / compute) service.
  4. EMR stands for Elastic __________ (MapReduce / Machine).
  5. Serverless means you don't manage __________ (servers / data).

True or False Exercises

  1. The cloud is just a magic place with no physical computers. (False)
  2. AWS is the only cloud provider. (False)
  3. Spark can read data directly from S3. (True)
  4. EMR clusters are free to run. (False)
  5. You should always terminate your cluster when done. (True)

Multiple Choice Questions

  1. What is cloud computing?
    A) A type of weather
    B) Renting computers over the internet
    C) A programming language
    Answer: B
  2. Which is NOT a cloud provider?
    A) AWS
    B) Azure
    C) Netflix
    Answer: C
  3. AWS EMR is used for:
    A) Storing data
    B) Running Spark
    C) Sending emails
    Answer: B
  4. S3 is used for:
    A) Running code
    B) Storing files
    C) Virtual machines
    Answer: B
  5. What does scaling mean?
    A) Adding or removing computers
    B) Writing code
    C) Deleting data
    Answer: A
  6. Which is a serverless Spark service?
    A) EMR
    B) Glue
    C) EC2
    Answer: B
  7. How do you read from S3 in Spark?
    A) s3://bucket/file
    B) file://bucket/file
    C) hdfs://bucket/file
    Answer: A
  8. Spot instances are:
    A) More expensive
    B) Cheaper but can be taken away
    C) Always available
    Answer: B
  9. What is a bucket in S3?
    A) A computer
    B) A folder
    C) A network
    Answer: B
  10. Which provider has a data centre in Nigeria?
    A) AWS
    B) Azure
    C) Google Cloud
    Answer: C
  11. What is auto‑scaling?
    A) Manually adding computers
    B) Automatically adjusting resources
    C) Deleting computers
    Answer: B
  12. Which is a way to save cloud costs?
    A) Leave clusters running
    B) Terminate clusters when not in use
    C) Use the largest instances
    Answer: B
  13. What does EMR stand for?
    A) Elastic MapReduce
    B) Elastic Machine Runtime
    C) Easy MapReduce
    Answer: A
  14. Serverless means:
    A) You manage servers
    B) You don't manage servers
    C) No computers are used
    Answer: B
  15. Which cloud provider is #1 in market share?
    A) AWS
    B) Azure
    C) GCP
    Answer: A

Matching Exercises

Match the term with its description:

TermDescription
1. AWSA. Amazon's cloud
2. S3B. Cloud storage
3. EMRC. Spark in the cloud
4. GlueD. Serverless Spark
5. EC2E. Virtual machines

Answers: 1-A, 2-B, 3-C, 4-D, 5-E

Short Answer Questions

  1. Explain why cloud computing is useful for Spark.
  2. What is the difference between S3 and EMR?
  3. What does "pay-as-you-go" mean?
  4. Why is scaling important for big data?
  5. How can you monitor a Spark job on EMR?

Scenario‑based Exercises

  1. Scenario: You have a 1 TB dataset stored in S3. You need to run a Spark job that takes 2 hours on your laptop. How can you use the cloud to finish the job in 10 minutes?
  2. Scenario: Your company has a budget of ₦50,000 per day for cloud costs. How would you choose cluster size to stay within budget?
  3. Scenario: Your Spark job failed because it couldn't find the input file. What could be the problem and how would you fix it?

Group Activity

Title: Cloud Provider Comparison

Instructions: In groups of 4, research one cloud provider (AWS, Azure, GCP). Prepare a 5‑minute presentation about:

  • What services they offer for Spark.
  • Their pricing model.
  • One interesting fact about their cloud.
  • A recommendation: would you use them for a Spark project?

Individual Activity

Title: My First S3 Upload

Instructions: If you have AWS access, create an S3 bucket, upload a small CSV file, and read it with Spark (using EMR or Glue). Write down the steps you followed.

Classroom Discussion Questions

  1. Why do you think cloud computing is growing so fast?
  2. What are the risks of using the cloud?
  3. How would you decide between AWS, Azure, and GCP?
  4. Should every company move to the cloud? Why or why not?
  5. How does the cloud help small businesses in Nigeria?

Mini Project

Title: Cloud‑Based Sales Analytics

Description: You have sales data for a Nigerian supermarket stored in S3. Use Spark on EMR to:

  1. Read the data from S3.
  2. Calculate total sales by region.
  3. Find the top 5 products.
  4. Save the results back to S3.

Deliverable: Spark script and a brief report on how you set up the cluster.

Practical Assignment

Title: Run Word Count on EMR

Instructions:

  1. Upload a text file to S3.
  2. Create an EMR cluster with 1 master and 2 core nodes.
  3. Write a PySpark script that counts words in the file.
  4. Submit the job to EMR.
  5. Save the output to S3.
  6. Terminate the cluster.
  7. Download and review the output.

Challenge Exercise

Title: Optimise Cloud Costs

Problem: Your company runs a Spark job every day that takes 4 hours on a 10‑node cluster. The cluster costs ₦10,000 per hour. You want to reduce costs by 50%. Suggest two strategies and explain how they would work.

Quiz Answers

Fill‑in‑the‑Blank Answers: 1. internet, 2. Amazon, 3. storage, 4. MapReduce, 5. servers

True/False Answers: 1. False, 2. False, 3. True, 4. False, 5. True

Multiple Choice Answers: 1-B, 2-C, 3-B, 4-B, 5-A, 6-B, 7-A, 8-B, 9-B, 10-C, 11-B, 12-B, 13-A, 14-B, 15-A

Matching Answers: 1-A, 2-B, 3-C, 4-D, 5-E

Key Takeaways

  • The cloud makes Spark accessible to everyone – no need for expensive hardware.
  • AWS, Azure, and GCP are the three big cloud providers.
  • AWS EMR is a simple way to run Spark clusters.
  • S3 is a reliable and scalable storage for your data.
  • Scaling helps you balance speed and cost.
  • Serverless options like Glue remove the need to manage clusters.
  • Always monitor your jobs and terminate clusters to save money.

Preparation for Module 6 – Real‑World Spark Projects

In Module 6, we will apply everything we have learned to real‑world projects. We will build an end‑to‑end data pipeline, work with real datasets, and solve actual business problems.

What to bring:

  • Your knowledge of Spark and cloud.
  • Your creativity and problem‑solving skills.
  • A willingness to build something amazing!

See you in Module 6 – let's build something great! 🏗️

🏆 Get Certified

🔒

Earn this certificate

Every lesson is already free to read. Sign up, finish the lessons, pass the exam (₦2,000 or 20,000 coins), and get a verified certificate with your name on it.

🎓 Sign Up to Get Certified
🛠️ Practice Tools
Hands-on simulators & labs - subscription required.
→
🎯 Internship Tasks
Real-world tasks to build your portfolio - unlock them with a subscription.
→