CS计算机代考程序代写 dns AWS School of Science, Computing and Engineering Technologies Swinburne University of Technology

School of Science, Computing and Engineering Technologies Swinburne University of Technology

COS80001 1

Remotely accessing & managing files on a Linux EC2 instance

Setting up an Apache HTTP server for a PHP website on a local
Windows machine

1. Remotely accessing a Linux EC2 instance via PuTTy

a. Create your own key pair to access AWS (one off)

Key Pair is used for securely accessing your EC2 instances. A key pair consists of two parts: public
key and private key. The public key is embedded in your EC2 instance, while you use the private
key to sign in securely. You can create multiple EC2 instances using the same key pair or assign
different key pairs to individual EC2 instances. In this unit, you only need to create one key pair.
You can get to the key pair management page via the “Network & Security – Key Pairs” in the menu
on the left-hand side of the EC2 dashboard in order to create or delete the key pairs.

NOTE: You need to store the private key file (in .pem format) safely and permanently since it is
generated only once when being created. You will not be able to download it again in case you lost
it, leading to you loosing access to your EC2 instances created with the lost key.

b. Convert .PEM file to .PPK file

You need a private key in .ppk format in order to SSH into your Linux instance. Follow the steps
below to convert the private key in .pem format to .ppk format:

• Download PuTTy and PuTTygen from here.
(https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html)

• Start PuTTygen to convert .pem file to .ppk file.

• Select ‘Load an existing private key file’ and select the .pem file generated previously.

• PuTTygen will convert this file to a .ppk file. Now click ‘Save private key’ to save the

• generated .ppk file. A passphase is not required here (unless you need additional security).

c. Connect to your Linux EC2 instance with PuTTy

Given the .ppk private key above, you can SSH into your Linux EC2 instance by:

• Launch PuTTY and enter your EC2’s public DNS as the host name.

• Navigate to Connection | SSH | Auth then click ‘Browse’ to select the .ppk private key file
exported from PuTTygen above.

• Navigate to Connection, then put a number other than 0 in ‘Seconds between keepalives’ field
to maintain the connection to EC2 and avoid being dropped out.

• Click ‘Open’. When connection comes up, enter the user name of your EC2 instance. For
Amazon Linux AMI or Amazon Linux 2, the default username is ec2-user.

Now you will be able to interact with your Linux EC2 instance via the terminal.

https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html
https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html

School of Science, Computing and Engineering Technologies Swinburne University of Technology

COS80001 1

2. Exchange files to a Linux EC2 instance with WinSCP

A quick and easy way to transfer/manage files on your Linux EC2 instance is to use WinSCP, a
Secure Copy and Paste file transfer client:

• Download WinSCP from here.
• (https://winscp.net/eng/download.php)

• Launch WinSCP. In the prompted Login dialog box, enter your EC2’s public DNS as the host
name and ec2-user as the user name. File protocol is SFTP.

• Click ‘Advanced…’ then navigate to SSH – Authentication.

• Select your private key file (.ppk) then hit ‘OK’.

• Click ‘Login’. Now you can start transfer files with your Linux EC2 instance.

3. Extra: set up Apache HTTP server on a local Windows computer

If you wish to develop a PHP website on a local Windows computer, you can install XAMPP. XAMPP
is an easy-to-install Apache distribution containing PHP and other packages. You can download it
from here (https://www.apachefriends.org/download.html). Follow the installation process
(Apache and PHP must be selected when asked) and remember the installation folder (C:\xampp
by default).

After the installation, launch the XAMPP Control Panel and start the Apache module. The Apache
HTTP server will now be running on port 80 (HTTP) and 443 (HTTPS).

The Apache HTTP server serves files in a directory called Apache document root (htdocs folder in
the XAMPP installation folder, C:\xampp\htdocs\). Trying creating a new folder, say cos80001, in
htdocs folder, then create a simple PHP file named index.php. If you can access the file via
http://localhost/cos80001/index.php on the browser, that means you have installed and
configured your Apache HTTP server correctly.

https://winscp.net/eng/download.php
https://winscp.net/eng/download.php
here%20
https://www.apachefriends.org/download.html
http://localhost/cos80001/index.php