1 of 99

10-605 AWS Setup

2 of 99

Today’s Goal: Create a DIY supercomputer

3 of 99

Quota increase request

4 of 99

Quota increase request

Search EC2 and select this

5 of 99

Quota increase request

Normally, we use G and VT instances (depend on your instance type).

You can choose either a spot instance or an on-demand instance based on your needs. �Spot instances are cheaper but may be terminated if there is a on-demand request. On-demand instances are more expensive but stable, as they cannot be occupied by others.

Select the type that suits your needs. We recommend requesting both instances, as you may use both of them.

You may have a value of 0 for both at this time.

6 of 99

Quota increase request

Take on-demand request as an example

7 of 99

Quota increase request

Take on-demand request as an example

Enter the amount you want. We recommend 8.

By clicking “Request” you are submitting your request.

It may take anywhere from a few hours to a few days to process, so be sure to request early!

8 of 99

Quota increase request

Take on-demand request as an example

Once you receive your quotas, you will be able to see your quotas here!

9 of 99

10-605 Setup for Homework

  • Quota increase request —— Done
  • Setup S3 Bucket
  • Setup IAM Roles
  • Make a keypair
  • Setup Security Groups
  • Setup EMR Cluster
  • Get Access to Jupyter Notebooks Interface
  • Terminate and clone EMR cluster

10 of 99

Credits and Budget Tips

11 of 99

Checking Credits

  • All students should have $150 put into their account.

To check your credits, from your AWS Main Page:

IMPORTANT: For 10-605/805 make sure you are connected to N. Virginia US-EAST-1

12 of 99

Checking Credits

Normally you should have $150. I have $300 because I have two courses.

13 of 99

Checking Amount Spent

  • Click Bills
    • Then you must click “Expand All” as it hides charges below:
    • “Expand All” might not appear until after you have used some services

14 of 99

Checking Amount Spent

  • Click Bills
    • Then you must click “Expand All” as it hides charges below:
    • “Expand All” might not appear until after you have used some services

15 of 99

IMPORTANT: Creating a Budget Warning

  • AWS is linked to your credit card you used to create the account. If you run over your $150 allowance then it will automatically start charging your card.
  • Every semester there is one student who leaves an instance or volume open for weeks because they neglected to set up warnings and they are left with a bill of literally thousands of dollars. The University is not responsible for this.
  • PLEASE: Set up budget warnings and triple check that you have terminated all instances and volumes!

16 of 99

Creating a Budget Warning

17 of 99

Creating a Budget Warning

Give your budget a name

Since the assignments are only over 1 month select “Monthly”

You can choose “Expiring” and select the appropriate start and end month

Choose “Fixed” and since the assignment can be completed with $30 I recommend using this as your Budgeted amount.

18 of 99

Creating a Budget Warning

19 of 99

Creating a Budget Warning

Set up an appropriate threshold of your budgeted amount. I used 80%

Add your email address

You can change this to “Forecasted” costs but this might cause AWS to warn you earlier than necessary, I’ll keep it on “Actual”

20 of 99

Creating a Budget Warning

21 of 99

Creating a Budget Warning

22 of 99

Creating a Budget Warning

23 of 99

10-605 AWS Setup

24 of 99

10-605 Setup for Homework

  • Quota increase request —— Done
  • Setup S3 Bucket
  • Setup IAM Roles
  • Make a keypair
  • Setup Security Groups
  • Setup EMR Cluster
  • Get Access to Jupyter Notebooks Interface
  • Terminate and clone EMR cluster

25 of 99

Setup S3 Bucket

26 of 99

Setup S3 Bucket

27 of 99

Setup S3 Bucket

Give your bucket a name. This name must be globally unique and not contain spaces or uppercase letters

Then click: “Create Bucket”

28 of 99

Setup S3 Bucket

29 of 99

Setup S3 Bucket - Adding Custom Bootstrap Action Script to Your Bucket

Later when we create an EMR Cluster we will need to set up some extra packages to be pip installed. Using bootstrapping allows us to start the cluster with these preinstalled!

  • Locally, create a plain text file with the following contents:

#!/bin/bash

sudo python3 -m pip install matplotlib pillow boto3 pandas

  • Name the file bootstrap_action_pip_emr.sh

30 of 99

Setup S3 Bucket - Adding Custom Bootstrap Action Script to Your Bucket

Click on the S3 bucket you created:

31 of 99

Setup S3 Bucket - Adding Custom Bootstrap Action Script to Your Bucket

Click the upload button:

32 of 99

Setup S3 Bucket - Adding Custom Bootstrap Action Script to Your Bucket

Drop your .sh file you created onto the page, then click the ‘Upload’ button in the bottom right.

33 of 99

Setup S3 Bucket - Adding Custom Bootstrap Action Script to Your Bucket

Your file should appear there:

Click on the the file.

34 of 99

Setup S3 Bucket - Adding Custom Bootstrap Action Script to Your Bucket

Click “Copy S3 URI” and paste it somewhere, you will need this later!

35 of 99

10-605 Setup for Homework

  • Quota increase request —— Done
  • Setup S3 Bucket —— Done
  • Setup IAM Roles
  • Make a keypair
  • Setup Security Groups
  • Setup EMR Cluster
  • Get Access to Jupyter Notebooks Interface
  • Terminate and clone EMR cluster

36 of 99

Setup IAM Roles

  • Identity and Access Management

37 of 99

Setup IAM Roles

You might not have any current roles

38 of 99

Setup IAM Roles

39 of 99

Setup IAM Roles

Search for “S3FullAccess”

Select “AmazonS3FullAccess”

This is allowing EC2 instances (which you will use in future homework) to have full access to all S3 Buckets.

40 of 99

Setup IAM Roles

Give your role a name

41 of 99

Setup IAM Roles

42 of 99

EMR Role Setup

  • Now create an EMR Service Role:

Click Roles

43 of 99

EMR Role Setup

Select AWS Service

Select EMR

From the drop down menu

Search EMR

44 of 99

EMR Role Setup

Select AWS Service

Select EMR

From the drop down menu

Search EMR

45 of 99

EMR Role Setup

Select Next

46 of 99

EMR Role Setup

Name your role, then click Create role at the bottom of the page

47 of 99

EMR Role Setup

Select your newly created EMR role

48 of 99

Setup IAM Roles

Select add permissions and attach policies

49 of 99

Setup IAM Roles

Search “AmazonElasticMapReduceRole” and select it

Add permission

50 of 99

Setup IAM Roles

51 of 99

10-605 Setup for Homework

  • Quota increase request —— Done
  • Setup S3 Bucket —— Done
  • Setup IAM Roles —— Done
  • Make a keypair
  • Setup Security Groups
  • Setup EMR Cluster
  • Get Access to Jupyter Notebooks Interface
  • Terminate and clone EMR cluster

52 of 99

Make a keypair

  • This is needed to access your EC2 instance and your EMR Cluster.
  • It is important that it is private and you know where it is saved.
  • First head to EC2

53 of 99

Make a keypair

Click “Key Pairs”

Then click “Create key pair”

54 of 99

Make a keypair

  • Once you click “Create Key Pair”, this will download a .pem. Make sure you save this somewhere safe where you can locate it.

Give your key a name, I recommend not using spaces

Select RSA

Select .pem

55 of 99

Make a keypair

56 of 99

Make a keypair - DONE Kind of…

  • Your .pem file is currently “Public” on your computer. When you try to access an instance with your .pem file it won’t allow you until you restrict the permissions.
  • How you do this depends on whether you are using Windows or Mac
  • On Windows, you may not need to restrict permissions

57 of 99

Make a keypair - Windows Instructions

  • Locate the file, right click and select “Properties”

58 of 99

Make a keypair - Windows Instructions

  • Click the “Security” tab, then “Advanced”.

59 of 99

Make a keypair - Windows Instructions

  • Click “Disable inheritance”, then “Convert inherited permissions into…”

60 of 99

Make a keypair - Windows Instructions

  • Remove “Users” if it is present by clicking on it and then clicking the Remove button. Then click OK

61 of 99

Make a keypair - Mac Instructions

  • In the terminal run
    • chmod 400 #KEYPAIRNAME
    • So I would run:
    • chmod 400 myawskey.pem

62 of 99

10-605 Setup for Homework

  • Quota increase request —— Done
  • Setup S3 Bucket —— Done
  • Setup IAM Roles —— Done
  • Make a keypair —— Done
  • Setup Security Groups
  • Setup EMR Cluster
  • Get Access to Jupyter Notebooks Interface
  • Terminate and clone EMR cluster

63 of 99

Setup Security Groups

  • First head to EC2

64 of 99

Setup Security Groups

Select your “default” security group

Click “Inbound rules” in the window here

Click “Edit inbound rules”

65 of 99

Setup Security Groups

  • The first rule will be used in later homework assignments and will let us access Jupyter Notebooks
  • The second is needed so that we can access our EC2 or later our EMR Instances

Click Add Rule

Delete any existing rules

Then add both of these rules.

MY IP

MY IP

Click “Save rules”.

66 of 99

10-605 Setup for Homework

  • Quota increase request —— Done
  • Setup S3 Bucket —— Done
  • Setup IAM Roles —— Done
  • Make a keypair —— Done
  • Setup Security Groups —— Done
  • Setup EMR Cluster
  • Get Access to Jupyter Notebooks Interface
  • Terminate and clone EMR cluster

67 of 99

Setup EMR Cluster

  • What is EMR? (Elastic MapReduce)
  • It is a managed cluster platform typically used for large data services
  • It lets us set up a master node and worker nodes similar to what we have been discussing in the course, allowing us to run Hadoop and Apache Spark to work with large datasets!

68 of 99

Setup EMR Cluster

69 of 99

Setup EMR Cluster

70 of 99

Setup EMR Cluster

Name your cluster, for release we are using emr-6.9.0

Select Custom!

71 of 99

Setup EMR Cluster

Hadoop, JupyterHub and Spark, no other choices should be selected

72 of 99

Setup EMR Cluster

While you are still developing your notebook I recommend using just 1 Core m4.xlarge instance, you can increase number and power of the machine once you have worked it all through on the subsample of the data and you want to run it on the entire dataset.

Maybe 2-4, m4.xlarge, be sure to keep an eye on your spending

73 of 99

Setup EMR Cluster

Remove task instance group as we will not need it

74 of 99

Setup EMR Cluster

You can increase the number of core (worker) instances here, as mentioned, we recommend using 1 when writing your homework to save on costs and bumping it up when you are ready to run it on the full dataset.

75 of 99

Setup EMR Cluster

Under Networking and EC2 Security Groups (Firewall)

For both the Primary and Core Nodes dropdowns select your default security group which you created earlier

76 of 99

Setup EMR Cluster

It’s up to you if you would like cluster termination. We recommend having it set to Manually terminate cluster, to avoid you accidentally leaving your cluster idle for an hour and having your homework progress being deleted. Just be sure to terminate it when you are not working on your homework so you don’t get charged

77 of 99

Setup EMR Cluster

We need to add a bootstrap Action. By adding the .sh file which we stored in our S3 bucket earlier

78 of 99

Setup EMR Cluster

Name your Bootstrap action whatever you would like.

Then add the Script location we got from the S3 bucket when we added the script using the ‘Copy S3 URI’ button we used.

79 of 99

Setup EMR Cluster

Uncheck “Publish cluster-specific logs to Amazon S3”

80 of 99

Setup EMR Cluster

Add the following to the Software settings. (Copy from the next slide)

81 of 99

Edit Software Setting

  • Configuring spark and enable persistence mode of Jupyter Notebook:
  • To the Edit Software Settings add:

[

{

"Classification": "spark",

"Properties": {

"maximizeResourceAllocation": "true",

"spark.executor.memory": "16G",

"spark.driver.memory": "16G"

}

},

{

"Classification": "jupyter-s3-conf",

"Properties": {

"s3.persistence.enabled": "true",

"s3.persistence.bucket": "YOUR-OWN-BUCKET_NAME"

}

}

]

Change these two to reflect your Primary and Core memory values. We chose m4.xlarge for both which both had 16G

Change it to your own bucket name

82 of 99

Setup EMR Cluster

Browse the for the EC2 Key pair which you created.

For these two, head to slide 27 for instructions on how to create the service role and the Instance profile role! Attach them here.

Once you are done here press Create Cluster

83 of 99

Setup EMR Cluster

Now the instance will start, keep an eye on the status here, it should take a while bootstrapping.

84 of 99

Setup EMR Cluster

Now that it is ‘Waiting’ we are good to go!

85 of 99

10-605 Setup for Homework

  • Quota increase request —— Done
  • Setup S3 Bucket —— Done
  • Setup IAM Roles —— Done
  • Make a keypair —— Done
  • Setup Security Groups —— Done
  • Setup EMR Cluster —— Done
  • Get Access to Jupyter Notebooks Interface
  • Terminate and clone EMR cluster

86 of 99

Get Access to Jupyter Notebooks Interface

Click Applications

Click this link

87 of 99

Get Access to Jupyter Notebooks Interface

  • Depending on your browser, you’ll get a ‘Your Connection Isn’t Private’ Message
  • Google how to get past this for your specific brower. For Edge:

Click Continue to ec2-....

88 of 99

Get Access to Jupyter Notebooks Interface

  • Once through you will be in JupyterHub
  • Username: jovyan
  • Password: jupyter

Click Continue to ec2-....

89 of 99

Get Access to Jupyter Notebooks Interface

  • Here you can upload your notebook handout.
  • IMPORTANT: Before you close your terminal or terminate your EMR Cluster make sure you download your notebook otherwise you will lose all changes!!!

90 of 99

Get Access to Jupyter Notebooks Interface

When you are in your notebook make sure that you change the Kernel to “PySpark”

91 of 99

Get Access to Jupyter Notebooks Interface

All set!

92 of 99

10-605 Setup for Homework

  • Quota increase request —— Done
  • Setup S3 Bucket —— Done
  • Setup IAM Roles —— Done
  • Make a keypair —— Done
  • Setup Security Groups —— Done
  • Setup EMR Cluster —— Done
  • Get Access to Jupyter Notebooks Interface —— Done
  • Terminate and clone EMR cluster

93 of 99

Terminate and Clone EMR Cluster

  • After you finish your work, please remember to save your updates and then terminate the cluster!

Terminate the cluster

94 of 99

Terminate and Clone EMR Cluster

Click Terminate

After a few minutes, you can see the status is terminated. (Please make sure you successfully terminate the cluster!)

95 of 99

Terminate and Clone EMR Cluster

  • Once you have cluster recordings, you can easily clone a new one to quickly start or edit configurations.

Select the cluster you’d like to clone and click “clone”

96 of 99

Terminate and Clone EMR Cluster

You can update the configurations and then click “clone cluster” to quickly start a cluster.

97 of 99

10-605 Setup for Homework

  • Quota increase request —— Done
  • Setup S3 Bucket —— Done
  • Setup IAM Roles —— Done
  • Make a keypair —— Done
  • Setup Security Groups —— Done
  • Setup EMR Cluster —— Done
  • Get Access to Jupyter Notebooks Interface —— Done
  • Terminate and clone EMR cluster —— Done

98 of 99

How about GCP? Aren’t we using that for HW3?

99 of 99

Huge thank you to the Fall 2025 TA Team!!

Special thanks to Baihong for updating this slide deck