Grzegorz Piechnik
Posted on December 28, 2023
When running performance tests locally, you may find that the hardware you are using is inferior. There are also other problems in the form of bandwidth or issues like the inability to use the local station for other purposes. Therefore, it is more stable to use cloud solutions such as aws ec2. How to create such an instance to be able to run tests on it?
Creating an instance
To begin with, you need to go to AWS and properly register an account. After filling in all the data, we enter EC2 Instances.
The next step is to correctly create instances. To do this, we click the orange “Launch instances” button at the top. This will redirect us to a subpage where we can select the type of machine, its operating system and enter its advanced settings. In our case, it will be the ubuntu system, whose name is my-test-instance.
It is important to create or select an existing key pair. Since we don’t have one, we create one from scratch. It is vital to select the correct key extension at the bottom (depending on what tool we will use to connect to the server).
After generating the key and moving on, we get a message that our instance has been created.
When we go to the list of instances again, a new record appears before our eyes. By clicking on it we get all the necessary information to connect to it.
By default, our instance is enabled. Remember to stop the machine when you are done by pressing Connect -> Stop.
Connect to the Instance
We can connect to the created instance in two ways, depending on what type of key we generated in the previous step.
SSH
The first way is a standard SSH session. To do this, open a terminal and execute the following command.
ssh -i KEYPAIR.pem PLATFORM@PUBLIC_DNS
In our case, it will be:
ssh -i my-test-keypair.pem ubuntu@ec2-18-132-63-123.eu-west-2.compute.amazonaws.com
Putty
Another option is to use the Putty tool. It is simply a program that is a client for TELNET, SSH and rlogin services. Putty is used when the graphical interface is more understandable to us and we want to be able to save many session settings.
In order for the connection to Putty to take place, three data fields must be completed.
- Host name (or IP address).
- User name.
- Private key file for authorization.
Transferring files to an ec2 instance.
As in the previous case, the tool used will depend on the previously selected generated key pair.
SCP
$ scp -i yourKey.pem C:\desinationPath ubuntu@publicDNS:/home/ubuntu/yourFileOrFolder
Putty
$ pscp -i yourkey.ppk C:\desinationPath ubuntu@public_DNS:/home/ubuntu/yourFileOrFolder
Downloading files from an ec2 instance.
Use the following syntax to download files or directory.
SCP
$ scp -i yourKey.pem ubuntu@publicDNS:/home/ubuntu/yourFileOrFolder C:\desinationPath
Putty
$ pscp -i yourKey.ppk ubuntu@publicDNS:/home/ubuntu/yourFileOrFolder C:\desinationPath
Posted on December 28, 2023
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.