How to Create EC2 Linux Instance

How to Create EC2 Linux Instance

  1. Log in to AWS Console and go to EC2 Service1 ec2 service home
  2. Choose an Amazon Machine Image (AMI)2 ec2 choose linux ami
  3. Choose an Instance Type
    3 ec2 choose instance type
  4. Configure Instance Details
    4 ec2 configure instance 14 ec2 configure instance 2
  5. Add Storage
    5 ec2 add storage
  6. Add Tags
    6 ec2 add tags
  7. Configure Security Group
    7 ec2 configure security group
  8. Review Instance, Launch and Select or Create Key Pair
    8 ec2 configure review9 ec2 create key pair
  9. Done! Verify created instance is ready
    10 ec2 created status

How to connect EC2 Linux instance from Windows using PuTTY

  1. Install PuTTY on your local computer
    • Download and install PuTTY from the PuTTY download page
    • Download the putty.exe and puttygen.exe file
      11 putty download
  2. Convert your private key using PuTTYgen
    • Open puttygen.exe, select RSA, and click on Load
      12 putty load file 1
  • By default, PuTTYgen displays only files with the extension .ppk. To locate your .pem file, select the option to display files of all types. Select your .pem file for the key pair that you specified when you launched your instance and click to Open. PuTTYgen displays a notice that the .pem file was successfully imported.
    12 putty load file 2
  • To save the key in the format that PuTTY can use, click Save private key. PuTTYgen displays a warning about saving the key without a passphrase. Click on Yes.
    13 putty convert file
  • In the Category, expand Connection type, expand SSH, and then select Auth
  • Click on Browse. Select the .ppk file that you generated for your key pair and Select Open
    15 putty connect ec2 2
  • Provide the name for the key that you used for the key pair (for example, dev-environment-key) and click on Save.
    PuTTY automatically adds the .ppk file extension.
    14 putty convert save ppk
  • For first time connection, PuTTY displays a security alert dialog box that asks whether you trust the host to which you are connecting, Click on Yes. A window opens and you are connected to your instance
    15 putty connect ec2 3

How to use EC2 Linux instance as a web server

  1. Update EC2 instance (system update)
    • Run Command for login as root user: sudo su
    • Run command to apply all updates on an EC2 instance: sudo yum update -y
      15 putty ec2 cmd2
  2. Install Apache web server on the EC2 instance
    • Run command to install Apache web server: sudo yum install httpd -y
    • Run command to check installed version of Apache web server: sudo httpd -v
      15 putty ec2 cmd3
  3. Create a simple web page running on Apache Web Server
    • Run command to go to the default root folder of the web server: cd /var/www/html
    • Run command to show the contents of html folder: ls
      15 putty ec2 cmd4
    • Run command for creating a file using nano editor: nano index.html
      15 putty ec2 cmd5
    • A new file opens named as index.html, and write html code
      15 putty ec2 cmd6
    • When finished, Press Ctrl + X to close nano editor, Press Y to save your changes, and then press Enter.
    • Run command for start Apache web server: service httpd start
      15 putty ec2 cmd7
  4. Test created web page from the browser
    • Copy Public-IP or Public DNS and paste on browser address – (Note: As SSL is not installed on the server, Use http protocol in the URL)
      16 putty ec2 app run

Done! Now, Your web page is running on your EC2 instance.

Learn More – How to Create EC2 Windows Instance

How to Create EC2 Linux Instance
Scroll to top