How to mine Ethereum on the cloud

Ng Tze Keat
6 min readApr 7, 2021


This guide will show you, step-by-step, how to set up a EC2 instance in the AWS(Amazon Web Services) cloud to mine the cryptocurrency, Ethereum.


An AWS account.

A computer.

A Ethereum wallet.

Step 1: Creating an instance

Location dropdown menu at top right of the console

Sign in to the AWS Console, and change the location to US East(Ohio). This is not mandatory, but Ohio offers some of the lowest cloud rates.

Services dropdown menu

Enter the EC2 service under Compute.


Click the Instances tab on the left bar, and click the orange “Launch instances” button.

Step 1: Choose an Amazon Machine Image (AMI)

Search for “deep learning”, and select “Deep Learning AMI(Ubuntu 18.04 Version 42.1)”. This particular image comes preinstalled with some prerequisites for Ethereum mining, including CUDA, making it compatible for GPU mining.

Step 2: Choose an Instance Type

For the next step, filter by “g4dn” and select the “g4dn.xlarge” type instance with 4 vCPUs. The “g4dn” family comes with GPUs, and this instance type is the most cost-efficient.

Step 6: Configure Security Group

Skip ahead to step 6, the previous steps can all be left with the default settings. Ensure the 3 rules shown above are created exactly as shown. It is imperative to the instance’s ability to send and receive data.

Creating a keypair.

Continue to Step 7: Review and Launch the instance. You will be prompted with the above popup. Create a new key pair, give it a name, and download it. This key pair, or “.pem” file, is crucial for us to connect to the instance. Now proceed to “Launch instances”.

Note: If an error citing a limit in vCPUs, your aws account is cleared for “g4dn” instance types yet. Follow the error to submit a support request for a limit increase to at least 4 vCPUs in the G instance type family, and wait a few days for your request to be approved before trying to create the instance.


Back on the instance page, you should see your instance initializing. Give it a few minutes to start up before moving on.

Step 2: Connecting to the instance


Search for “cmd” in the bottom left of your computer, and enter the command prompt.

Use the “cd” command to enter the downloads file(or wherever you downloaded the “.pem” file to earlier). Then, enter a ssh command in the format:

“ssh -i “[your .pem file]” ubuntu@[instance’s public ipv4 DNS]”.

I named my keypair “ohiokp” when I created it, and my instance’s public ipv4 DNS address is “ec2–18–191–251–”. Thus, I would enter

“ssh -i “ohiokp.pem” ubuntu@ec2–18–191–251–”

Note: The instance’s public ipv4 DNS can be found in the instance’s details back at the AWS EC2 console Instances view.

Step 3: Server Setup

“Landing page”

Once you successfully connect, you will be greeted by a chunk of text about the state of the machine. Enter(or copy paste) the following commands into the prompt. Be sure to allow each command to finish executing (let the prompt appear again) before executing the next.

sudo su

Gives server administrator(root) privileges/permissions.

apt-get install software-properties-common

Provides some useful scripts for adding and removing packages.

add-apt-repository ppa:ethereum/ethereum

Adds the Ethereum Personal Package Archive(PPA) into the system.

apt-get update

Updates the system.

apt-get install ethereum geth

Downloads Geth(Go Ethereum), a library used for accessing the Ethereum network. Be sure to enter “Y” when prompted to continue the installation.


Downloads Ethminer, the mining software.
Note: As of April 2021, 0.19.0-alpha.0 is the latest release of Ethminer. Check for any newer releases at

mkdir ethminer

Creates a directory(folder) “ethminer” in which the software files will be stored.

cd ethminer

Sets our current directory to “ethminer”

tar -xzvf ../ethminer-0.19.0-alpha.0-cuda-9-linux-x86_64.tar.gz

Extracts the contents of the downloaded “.tar.gz” file to the current folder.

Step 4: Mining

Now, we must start Ethminer and connect to a pool. In case the miner is ever interrupted, the below commands will also restart it.

pkill screen

Kills all running screens, if any.


Starts a new screen. This allows the miner to continue running even after you close your ssh session. If you want to return to the screen, use screen -r.

cd /home/ubuntu/ethminer/bin

Navigates to the directory containing “ethminer.exe”.

Now, for the big command — starting the mining software. you will need your Ethereum wallet’s public address(the one starting with “0x”), and a Ethereum mining pool of your choice. Different mining pools will have different formats for this command.

Ethermine is a pool with a relatively simple format:

./ethminer -P stratum://[WALLET ADDRESS].[A NAME FOR YOUR MINER]:@[SERVER]:4444;

For example, my Ethereum public wallet address is


(You can send a tip if you liked this guide. Email if you did for a useful little tip!)

I want my miner to be called


, and I want to mine on Ethermine’s US-East server.

In this case, the command would be formatted as:

./ethminer -P stratum://

Chugging along!

Now, you should begin to see line after line of alerts for jobs and system information slowly pop up, one after another. The miner is working.

Finally, press ctrl+Athen ctrl+D to disconnect from the screen. Now you can close the Command Prompt and end the SSH session.

Conclusion: A word of caution

Miner dashboard at

This basic guide is but a introduction and experiment of sorts into mining crypto on the cloud. The reality of the situation is that cryptocurrency mining, in any form, may not always reap a return on investment or go as planned. Even with the reduced upfront cost and risk of mining on the cloud, not to mention technical difficulty of more advanced, large scale operations, mining crypto on the cloud poses a significant risk if one is not exceedingly careful in putting time and effort into research pre-venture. Be wary!

Nevertheless, I hope you enjoyed this guide and learned a thing or two. Stay safe, and happy mining!