You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I'm currently preparing AWS Certified Solution Architect - Associate certificate.
The following gist is intended to AWS users to learn more about Amazon Elastic Compute Cloud.
I performed this setup on my Ubuntu 18.04.2 LTS.
To check your OS version, execute $ lsb_release -a in your Terminal.
Installations
None. Just log into your AWS management console, https://console.aws.amazon.com.
You'll need to perform several tasks in your CLI regarding SSH keygen, so make sure you check the following prerequisites.
Prerequisites
First, make sure Oracle jdk is installed. I recommend java 1.8.0
To uninstall effectively your current jdk, perform this: $ sudo apt-get remove openjdk* $ sudo apt-get remove --auto-remove openjdk* $ sudo apt-get purge openjdk* $ sudo apt-get purge --auto-remove openjdk*
To install java 1.8.0, open Terminal Ctrl+Alt+T and run the command: $ sudo add-apt-repository ppa:webupd8team/java // adds PPA repository $ sudo apt-get update // updates package list $ sudo apt-get install openjdk-8-jdk // installs openjdk
$ javac -version // shows your new java version
Author
Isaac Arnault - AWS Cloud series - Related tags: #EC2 #WebServer
$ https://console.aws.amazon.com. // log into your AWS management console
I'm using MFA to secure my root account access coupled with Google Authenticator on my Android smartphone.
You can bypass this step and login normally.
π΄ See output
Go to Services > EC2
In Create Instance section, click on Launch Instance
π΄ See output
Select Amazon Linux 2 AMI (HVM), SSD Volume Type
Instance type: choose t2.micro (Free tier eligible). Instance comes with 1vCPU and 1 GiB (memory).
Click on "Next: Configure instance details"
Configure instance details : leave all fields as they're by default, just Enable termination protection.
π΄ See output
Next : Add Storage
Leave default configuration.
Next: Add Tags
You can leave tags blanks, here I'm using some tags for my own needs.
π΄ See output
Next : Configure Security Group
Click on "Add rule" to allow Port 80 on Http. Ignore the warning and click on "Review and Launch" then "Launch".
π΄ See output
Now you are about to create a key pair to securely SSH into your instance. Select Create a new key pair, name it as you want then Download Key Pair. This should download a .pem file. Mine is MYKP1.pem.
Create a new folder named "SSH" on your "Desktop", then move the .pem file to the newly created folder.
Change the permissions to .pem file, ie: $ chmod 400 MYKP1.pem.
Connect to your EC2 instance using your IPv4 Public IP Address:
$ ssh ec2-user@myipv4.public.address -i MYKP1.pem
Then type "yes" when prompted by the CLI.
Now, you should be connected to your EC2 instance through SSH.
π΄ See output
Important
If connection failed, you are probably blocked by a proxy (you are trying to connect from a Public Libraby for example) not allowing your device using Port 22, which is the default port used by the SSH.
Another method : Secure Shell App (Web)
Now we are going to use another method if you want to connect to your EC2 instance, if you can't / do not want to use your CLI. We are going to use Secure Shell App extension in our Chrome browser.
Search for "Secure Shell App" in your Search Engine and Download it as below :
π΄ See output
Once installed, you should see this. Then click on "Secure Shell App" icon.
π΄ See output
If everything goes well, enter the following information into your Secure Shall App as follows : your username (ec2-user) and your hostname (provided by your EC2 instance).
Go in the SSH folder where you stored the .pem file from your CLI and generate a public key from the .pem using $ ssh-keygen -y -f MYKP1.pem > MYKP1.pub.
Now you should have 2 files, MYKP1.pem and MYKP1.pub. Duplicate MYKP1.pem file and rename the new file to MYKP1 (just remove .pem extension). In the Identity section of the prompt, upload both the MYKP1.pem and MYKP1 file .
π΄ See output
There you go, if everything went fine you should be prompted by the Secure Shell App, type "yes" and you should see the same display as you would normally see in your CLI.
π΄ See output
Let's get back to your installation using your CLI. The following steps are not performed in Secure Shell App, but you can perform them there.
Elevate your privileges to root using $ sudo su and perform $ yum update -y to update your CLI with the latest available packages.
Install Apache HTTP Server from your CLI. This will basically turn your EC2 instance to a web server, use $ cd /var/www/html to make your web server's files accessible by Port 80.
Let's create a sample index.html file using $ nano index.html
π΄ See output
To start the httpd service, use $ service httpd start.
π΄ See output
There you go, type your IPv4 public address in your browser and you should see your Web Server online.