There might be some scenarios, where you may want to transfer files from an Amazon EC2 instance to your local system or from local system to Amazon EC2 instance. There are various tools such as FileZilla, FTP etc. that can be used to transfer files to Amazon EC2 instance from local Windows or Linux system. Here, we would explain a very useful tiny tool “WinSCP” to transfer files to Amazon EC2 Linux instance from local system and vice-versa.
Steps To Transfer Files To Amazon EC2 Linux Instance From Local System
To transfer files to Amazon EC2 Linux instance from your local system, you need to perform the following steps:
Just double-click the setup file and complete the installation of WinSCP tool using the default selections.
Open the WinSCP console and fill the information such as Host name: Public IP or DNS domain name. User Name: User name of EC2 instance. Port: Default 22.
Click the Advanced button. The new window will be displayed. Select the SSH in the left pane and then select Authentication.
Here, you need to browse and select the keypair key (extension .ppk) that you have converted previously.
Click OK to proceed and then click Login. On the Warning dialog box, click Yes to proceed.
On the WinSCP console, select the local files from left pane and drag the files (that you want to transfer) in the right pane. The default EC2 file location is user’s home directory.
To verify, connect your EC2 instance and list the files under user’s home directory. You should be able to see the files you have transferred from the local system to EC2 Linux instance as shown in the following figure.
In the previous post, we have explained how to create and launch an EC2 instance. Here, we assume that you have already running a EC2 instance and now want to connect EC2 instance. There are various options that you can use to connect your EC2 instance. Here, we will discuss “How to connect EC2 Linux Instance and work remotely. We will cover Windows EC2 instance connection options in a separate article.
You can connect an EC2 Linux instance using the following method:
In this method, you can use your Web Browser to connect EC2 instance. However, you need to install the compatible version Java for your browser. Few of the Web Browsers such as Chrome may not work properly for the EC2 connection. We recommend to use Internet Explorer with compatible version of Java installed. To connect your EC2 instance using Web Browser, you need to perform the following steps:
First, download the compatible version of Java and install it properly. The process is pretty simple and should not be a challenge for a technical guy.
Once the Java is installed, make sure you have also turned on the Java Adds-on in Internet Explorer as shown in the following figure.
Now, select and right-click your EC instance and then select Connect.
On the Connect To Your Instance window, select A Java SSH Client Directly option.
Browse and select the key pair associated with this instance, and then click Launch SSH Client as shown in the following figure.
A new terminal console will be displayed and you will get the EC2 terminal console, where you can perform the desired tasks for your EC2 instance as shown in the following figure.
Connecting EC2 Linux Instance Using PuTTY
PuTTY is the most popular tool to access SSH and other remote connections such as Telnet. Most of the AWS Administrators use PuTTY to connect EC2 Linux instances. In this method, we are going to explain how to use PuTTY to connect EC2 instances.
Once you download and installed the above mentioned tools, open the PuTTYgen console.
Click Load and browse the key pair, in the browse window select the File Types as All and then select .pem file.
Click Load to save the key pair file from .pem to .ppk. Optionally, you may also set the passphrase for this converting key for more security.
Now, open the PuTTY tool and paste the Public IP or DNS name of your EC2 instance. The format should be followed as user@ec2-public-ip-address or user@ec2-domain-name. example: firstname.lastname@example.org
Scroll-down in the left pane, expand the SSH section and select Auth option.
Browse and select converted key pair (extension .ppk) and then click Open to open the SSH console.
A Security Alert will be displayed, read it and click Yes to proceed.
Now, you should be able to access terminal of EC2 instance as sown in the following figure.
Connecting EC2 Instance Using GitBash
Apart from the above-mentioned methods to connect EC2 instances, there are few more tools such as GitBash that you can use to connect EC2 Linux instances. GitBash is my most loved tool for connecting EC2 Linux instances. You just need to download and install it, which is pretty simple.
For the Windows version of GitBash, double-click the setup file and just follow the on-screen installation instructions.
Needless to say that AWS Amazon is real leader in Cloud platform. Many reputed companies’ infrastructure is hosted on AWS Cloud. If you have never worked with Amazon AWS platform, do not worry, we would explain all the important step by step tutorials to learn Amazon AWS easily. In this post, we will focus on “how to create EC2 instance using AWS console”.
Note: You can also change the instance AMI type later as per the future requirements.
Selecting EC2 Instance Type
EC2 Instance Types are actually profiles with pre-defined hardware and other resources settings such as number of vCPUs, RAM and Disk size. You can choose any of the available instance type as per your requirements. However, instance type containing more hardware resources would be more expensive than others. Luckily, there is one option called Free Tier that allowed you to create and use a T2 Micro instance free of cost with limited time of period. For the testing purpose, select the T2 Micro instance type and proceed to the next page.
In this page, you need to specify some basic settings for your EC2 instance. The following are the basic settings that you need to adjust:
Network: Use the default VPC or create a new one.
Subnet: Use the default subnet or create a new subnet as per your requirements.
Auto assign IP: If enable, then a public IP would be assigned to this EC2 instance, else no public IP would be assigned to this instance.
Adding Storage with EC2 Instance
In this page, you can use the default allocated storage size (8 GB), you can increase it, or you can also add multiple volumes as per your storage requirements. For the testing purpose, just accept the default setting and proceed to the next page.
Adding Tags for EC2 Instance
In this page, you can define tags to identify and differentiate your instance. As of now, adding Name tag would be sufficient. Click Add Tag, specify instance name, and proceed to the next page.
Configuring EC2 Security Group
AWS security groups are actually virtual firewall that controls the inbound and outbound network traffic. Here, at least you need to allow SSH service for remote access. For this exercise, you can allow SSH it for all IPs, but we highly recommend to select My IP Address option to limit the SSH access. In the production network, be careful and only allow the required ports in security group.
Launching EC2 Instance
Proceed to the Review page and click Launch to launch instance. The Key Pair window will be displayed. Here either you can use an existing Key Pair or create a new one. For the first time, select create a new key pair, specify key pair name, and then click Download Key Pair.
Finally, click Launch Instances to launch this instance. The instance will be ready within few minutes and you would see it in the EC Instance list in AWS console.
That’s all you need to do to create EC2 instance using AWS Amazon console. Now, you can connect your instance and perform the management task as per your requirement. You can use Putty, GitBash, or any other tool as per your comfort to connect an EC2 instance.
We will discuss all the remote connect options for an EC2 instance in a separate article, so stay connected with us. Please like and share us.