🔗 Link: https://awsrestart.instructure.com/courses/1632/modules/items/886859
📁 Repo: https://github.com/francopig/aws-python/tree/main/18. Script
Using SSH to Connect to the Linux Host
Windows Users: Using SSH to Connect
These instructions are specifically for Windows users. If you are using macOS or Linux, skip to the next section.
- Click the Details drop down menu above the instructions you are currently reading, and then click Show. A Credentials window will be presented.
- Click the Download PPK button and save the labsuser.ppk file.
Typically your browser will save it to the Downloads directory.
- Exit the Details panel by clicking the X.
- Download PuTTY to SSH into the Amazon EC2 instance. If you do not have PuTTY installed on your computer, download it here.
- Open putty.exe
- Configure PuTTY timeout to keep the PuTTY session open for a longer period of time:
- Click Connection.
- Set Seconds between keepalives to
30
.
- Configure your PuTTY session:
-
Click Session.
-
Host Name (or IP address): Paste the IP address of the Linux Host instance you saved in the file earlier.
Lab Details
-
Back in PuTTY, in the Connection list, expand SSH
-
Click Auth (don't expand it).
-
Click Browse.
-
Browse to and select the labsuser.ppk file that you downloaded.
-
Click Open to select it.
-
Click Open again.
- Click Yes, to trust and connect to the host.
- When prompted login as, enter:
ec2-user
.
This will connect you to the EC2 instance.
Your Challenge
- Write a Python script to:
- Display all the prime numbers between 1 to 250.
- Store the results in a results.txt file.
- Test the script. Verify that it produced the expected results in the results.txt file.
- Save the script and make a note of its location (absolute path) for future reference.