Use Go-Ethereum to Setup an Ethereum Blockchain on AWS – Part 1, MLG Blockchain

blockchain on aws

Often in a blockchain development cycle you will need to put your blockchain on the cloud to enable other knots to link to it for testing and development, or for other miners to mine for proof of work blockchain. The two most popular cloud providers for a blockchain solution are Amazon Web Services (AWS) and Microsoft Azure. Both have the option to embark with a free trial and to only pay based on your usage.

This is a three part blockchain development tutorial series on Ethereum that will concentrate on how to launch your own Ethereum blockchain using Geth on an AWS server, then connect it to another knot to begin mining or interact with the same brainy contracts. This very first tutorial will explain how to very first configure and connect to your Amazon Virtual Machine. The 2nd section will explain how to install and configure your Ethereum blockchain using Geth on Ubuntu. The third section will walk through how to connect a 2nd knot to your cloud example of Ethereum. We will follow-up with more tutorials that explain how to launch a blockchain example on other cloud providers such as Azure and Digital Ocean.

Setup Amazon EC2 Example

To begin you need to sign-up to AWS console and launch at least two EC2 Ubuntu 16.04 servers. You can launch your two EC2 Ubuntu Servers by going to the AWS website and then in the menu you go to the products tab, then to compute and then click on EC2. On the name page click on get embarked with Amazon EC2 and then register and verify an email. If you have already setup EC2 servers you can proceed to the next section.

Once you have registered, sign into your Amazon console. In the navigation bar, hover over services and then click on EC2 which will bring you to the screen below. As you can see, this MLG Blockchain account is presently running two EC2 instances, with two volumes, one key pair and three security groups. Before you have any account activity your numbers should all be at 0. Look for the 2nd section called “Create Instance” and click the button “Launch Instance”.

You can also click on the tab on the left called “Instances” which should bring you to the screen below that shows all the servers that are running on your account. From here you can click on the blue “Launch Example” button on the top left, which will bring you to the same screen as clicking the button on the previous screen. This Example menu shows you the name of each example you are presently running, the unique identifier, the type, the zone the example is running (you can run your cloud servers from anywhere), the state, whether it is working, any problems, and then a last field called public DNS which I have left out of this picture to avoid anyone attempting to fasten to either example.

After you click on “Launch Example” it will bring you to the screen below, to choose a Amazon Machine Picture (AMI). To go after along with this Ethereum tutorial click on the fourth option to setup a Ubuntu Server 16.04 LTS server, however you should be able to setup an Ethereum blockchain with Geth on any of the servers shown here.

After you select your AMI you will need to select your example type. We chose a medium server to have more memory and not crash during testing or development, but you can choose any size depending on your expected usage.

You can proceed past the next screen to configure your example details as you don’t need to make any switches. The next step is to review all the details you submitted to ensure that they are all correct. You can either check the box to delete on termination or not. If it is checked it means that if you delete a EC2 example, it will also delete the data on it. We recommend this option to avoid storing extra data in the cloud. Once you have ended all your configuration you need to add in tags, such as the name of the example. You can name your example whatever you want. As shown above, the very first MLG knot is called mlg-ethchain and the 2nd is called mlg-node2.

Setup Security Groups

Setting up a security group on a Amazon EC2 example is done to let the server know which ports to accept inbound or outbound data from. Very first you need to name your security group and include a description, or you can use an existing security group if you have already set one up. To go after along with the tutorial, we have shown which inbound ports we open. The very first SSH type is the default one. The other two are to listen to the Geth network will will be setting up in the 2nd part of this tutorial series. Afterwards, click on confirm and launch and then congratulations you have configured your very first Example on AWS!

Setup Key Pair

As you launch your EC2 example, you will see an alert demonstrate up to either select an existing key pair or to create a fresh key pair. Setting up your key pair is to enable you to securely SSH into your example, while ensuring that others cannot. As shown in the pic, your key pair consists of a public key which AWS stores and a private key which you store on your computer. Make sure that you have checked the box to acknowledge that you have access to the selected private key file and then click on choose a fresh key pair and then click on “Launch Instances”.

Now that you have finished activating your cloud server and you have downloaded your key pair you should be shown a screen to confirm your Example has been setup decently and an ID for your Example. If you click on the ID it will bring you back to your instances section shown above and display your fresh example loading. It might take a few minutes to finish loading, but be patient as you need it to accomplish for it to come back the public IP that enables you to connect to your cloud example. Once if is finished loading and it has returned your public IP you are able to SSH into your EC2 from your terminal, using the key pair that you just created.

SSH into your EC2 Example

From your terminal, switch directory to the folder that has the key pair you just downloaded and input the guideline below. This instruction should take some time to react and when it does it will come back your ECDSA key fingerprint and ask if you want to proceed connecting. Type yes, then click inject, and your terminal will react that you have permanently added your public IP to the list of known hosts, which will give you directive line access to your machine. If it is configured decently, you should see a success message returned afterwards.

ssh -i .pem ubuntu@

From here you can see your working directory you can connect your Ethereum blockchain to. Below, you can see the contents of our Ubuntu server. We will explain how to install Geth and configure your blockchain in the next section of this tutorial.

Related video:

Leave a Reply

Your email address will not be published. Required fields are marked *