You are unable to ever generate this again.
You will now see your key “Fingerprint” — remember how to find this later.
This is all we need to do at this step, keep the download safe.
Security note: Do NOT do what I’m doing in this tutorial and show any of these details to anyone else (or include them in any public code) as otherwise they maybe able to access your instances.
I deleted everything afterwards.
Step 3— Launching an instanceThis can appear to be quite confusing step, however if you just accept most of the defaults it is relatively simple.
Firstly click on “Launch Instance” on the console, which will bring up a page giving you all the different options of Amazon Machine Images — better thought of as essentially the operating system that will be preloaded on the instance.
Many options, I have been using the second on the list.
Once you select the desire option you get to choose the “power” of the instance, included for free is only one option called “t2.
Yes its relatively limited at only 1GB Memory but remember this is running a really stripped down operating system so it is actually surprisingly quick.
So at this point we are going to take a short cut; there are 4 further configuration steps however they are relatively complicated and for the purpose of the blog not necessary so go straight to “Review and Launch” (this automatically gives you 8GB of storage way more than you need for this activity).
This is the final review screen — click launch.
This is where a pop-up will appear and we need to remember the name of our key from earlier.
As this is a new account you should only have one key so there are no options at this point (if you had more than one keys then you would select the correct one at this point).
Tick the box and click “Launch Instances”, then on the next screen click on “View Instances” which will return you to the console.
You can get to this screen at any time from the left hand menu in the console.
You will now see you instance and it will be initialising.
In the “Name” column hover over the blank space and click on the edit button that appears and give it a sensible name (In my case “Test Instance”).
That is the end of what we need do at this point on the AWS console.
Congratulate yourself you have created your first instance!Step 5 — Setting up TermiusThis really is basic, go to https://www.
com/ , create a free account and download the appropriate version (Windows, iOS etc).
Once downloaded sign in.
Step 4 — Accessing and controlling your instanceThere are many ways of doing this, I have picked Termius because it has GUI that is quite easy to use.
What are we trying to achieve?Upload files to our instance storageAccess the command line of the instance (to enable us to run our code)The first thing we need to do is create a link between our Termius console and the instance we have just created.
To do this we will be connecting via SSH (Secure Shell) .
Once you have signed in to Termius this is the home page you will be looking at.
This will be referred to as the Termius ConsoleThe first thing that we need to do is setup a key within Termius — this is the second half of the process started in Step 2.
The key has two components a private key and a public key.
We have already seen the public key — that is the fingerprint that we saw in the EC2 console.
The private key is generated once and once only by the EC2 console during the key setup — the only place that the private key is stored is in the downloaded .
pem file — so do not loose it!.It is important to key this key private and secure — depending on your use case depends on the degree you go to in doing this.
The public key is stored within your EC2 console and when you attempt to connect the SSH protocol will use this information and your private key to validate and authorise the connection.
So explanation over — lets get this key setup.
Click on your email address top left and the following drop down menu will appear.
FYI this is also where you can see how long you have left of your free trial.
Click on Keychain.
Then once you have clicked add key, fill in the details as so.
It would be advisable to choose a sensible naming convention (i.
same name as on EC2).
The Private Key is located in the .
pem file — copy the entire file (including “Begin RSA Private Key”.
The Public Key is the “Fingerprint” from the EC2 console.
These details should never normally be shared!!Once saved, navigate back to the main console page and click on “New Host”.
Label (would call it the same as on EC2), address is the IPv4 public IP address.
Username is “ec2-user”, then click on Keys and select the key that you have just setup.
Once saved, when you return to the hosts page you will now find your instance.
Double click on this to launch a connection, the first time you do this you will get the warning as follows, click yes.
The instance will now appear in the left hand bar, if you have multiple instances you can switch between them here.
The following should now appear in the main Termius console panel.
Success the instance is up and running, and we have connected to it!Step 5 — Configuring your instanceCurrently the instance is a basic Linux setup, with a few pre-configured packages (python 2.
7 being one of them).
In this step we will go through how to setup a Miniconda and a virtual environment.
Firstly run the suggested “sudo yum update” to make sure everything currently installed is up to date.
Then run “wget https://repo.
sh” — this will download the latest Miniconda for Linux into the instances storage.
Once downloaded we need to install Miniconda “ bash Miniconda3-latest-Linux-x86_64.
sh” (accept terms, location and activate Miniconda)Important step!!.Reboot the instance — if you do not do this conda will not work!!The Termius console will prompt you to reconnect — wait until the EC2 console shows that initialisation has been completed.
We now have an instance setup with Miniconda — good work!Optional Step 5.
1— Setting up a virtual environmentAs with any computer it is good practice to setup virtual environments to contain any packages that you are using for a specific project to prevent clashes etc.
This is relatively straightforward, and the same as for any Linux system.
You can choose what version you want to set the instance up with — also if including “Anaconda” afterwards the env will be setup with the full version of Anaconda rather than Miniconda.
conda create -n test_env python=3.
7Once that has been created, activate with:conda activate test_envStep 6 — Transferring files and running your codeWe are very close now!So fortunately for us Termius has a very straight forward file transfer mechanism using SFTP.
So on the left hand menu click on SFTP.
Select the host that you have just setup, and then using the folder structure and the “Actions” drop down at the top you can select and transfer a file onto the instance storage.
I’ve transfered two files a test.
py and a sample.
All the test file does is import the sample.
csv and return the length of the dataframe.
Code in test.
pyAs we only installed Miniconda pandas is not included so must be installed in the instance / env seperately.
Run “conda install pandas” in the instance console within Termius.
To run the code type “python test.
py” in the Termius console.
Success!.The code ran, imported pandas, read the csv file and correctly returned its length at 20000 rows.
Step 7 — Continue LearningAs mentioned at the beginning this is simply one way of using EC2 on AWS — there are different ways/ better ways, this is just a relatively simple way to get started.
I hope this was useful and you enjoy using AWS and continue learning.
.. More details