Amazon Web Service - AWS: Difference between revisions

From Embedded Workshop
Jump to navigation Jump to search
No edit summary
No edit summary
 
(11 intermediate revisions by one other user not shown)
Line 16: Line 16:
Connect to your instance via SSH (I prefer to use TeraTerm for my SSH connection). Within your instance dashboard, for your currently running instance, find the Public DNS (IPv4) address. Example: ec2-18-237-174-213.us-west-2.compute.amazonaws.com - Follow step by step detailed below...
Connect to your instance via SSH (I prefer to use TeraTerm for my SSH connection). Within your instance dashboard, for your currently running instance, find the Public DNS (IPv4) address. Example: ec2-18-237-174-213.us-west-2.compute.amazonaws.com - Follow step by step detailed below...


Connect with TeraTerm - Tera Term Download
Connect with TeraTerm - Tera Term Download:
https://ttssh2.osdn.jp/index.html.en  or
https://download.cnet.com/Tera-Term/3000-2094_4-75766675.html
* Select TCP/IP
* Select TCP/IP
* Check History
* Check History
Line 22: Line 24:
* Service SSH, SSHVersion SSH2
* Service SSH, SSHVersion SSH2
* Click "OK"
* Click "OK"
* User Name: ubuntu   (This is the initial default user name for all Ubuntu instances.)
* User Name: '''ubuntu'''  (This is the initial default user name for all Ubuntu instances.)
* Select "Use RSA/DSA/ECDSA/ED25519 key" and select the private key you downloaded earlier (Show all file types)
* Select "Use RSA/DSA/ECDSA/ED25519 key" and select the private key you downloaded earlier (Show all file types)
* Click "OK"
* Click "OK"
Following the above steps should produce an SSH command prompt for your AWS Linux instance.
 
Connect with Putty: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/putty.html)<br>
Connect with Linux terminal: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AccessingInstancesLinux.html<br>
 
The above steps should produce an SSH command prompt for your AWS Linux instance.


Let's perform a couple status checks...<br><br>
Let's perform a couple status checks...<br><br>
Line 55: Line 61:
* screen
* screen
* busybox  (very few, if any, sym-links to this application)
* busybox  (very few, if any, sym-links to this application)
  Any scripting language support?  Java: NO  Python: NO
  Any scripting language support?  Java: NO  Python: Yes version 2.7.18
 
  Compilers?  cc: NO, gcc: NO
  Compilers?  cc: NO, gcc: NO


Line 66: Line 73:
  Append the following on the end of .bashrc
  Append the following on the end of .bashrc
  # define current timezone so the date command reports correct local time
  # define current timezone so the date command reports correct local time
  TZ=CDT+5
  export TZ=CDT+5


* Install Midnight Commander (mc)
* Install Midnight Commander (mc)
* Install Apachi Web Server
* Install Apache Web Server
* Install Tight VNC Server
* Install Tight VNC Server
$ sudo yum update -y  (This will add Python 3.7.9)
$ sudo yum install httpd -y


$ sudo apt-get install apache2
  The default document root for Apache is: /var/www/html/
  The default document root for Apache is: /var/www/html/
  The server is looking for "index.html" to use for the default web page.
  The server is looking for "index.html" to use for the default web page.
  Rename the current one and replace it with your own:
  Rename the current one and replace it with your own:
   
  $ cd /var/www/html
  $ mv index.html index.html.bak
  $ sudo mv index.html index.html.bak
  $ cp jim.html index.html
  $ sudo cp jim.html index.html     < This assumes you have a replacement file...


A few links to get started with HTML
https://www.w3schools.com/html/default.asp
https://colorlib.com/wp/templates/
https://www.w3schools.com/w3css/w3css_templates.asp


Shutdown (and power off) the service
Shutdown (and power off) the service
  $ sudo shutdown -P now
  $ sudo shutdown -P now


https://aws.amazon.com/
A few links for AWS:
 
https://aws.amazon.com/
'''AWS Life Cycle'''
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-lifecycle.html
'''AWS Life Cycle'''
 
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-lifecycle.html
'''Connecting in for the first time'''
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AccessingInstancesLinux.html
'''Connecting in for the first time'''
 
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AccessingInstancesLinux.html
sudo service --status-all
 
https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_Tutorials.WebServerDB.CreateWebServer.html
 
proc]$ cat /proc/version
Linux version 4.14.77-70.59.amzn1.x86_64 (mockbuild@gobi-build-64001) (gcc version 7.2.1 20170915 (Red Hat 7.2.1-2) (GCC)) #1 SMP Mon Nov 12 22:02:45 UTC 2018
[ec2-user@ip-172-31-27-115 proc]$
 
https://www.mediawiki.org/wiki/Manual:Running_MediaWiki_on_Red_Hat_Linux
 
mysql> CREATE USER 'new_mysql_user'@'localhost' IDENTIFIED BY 'THISpasswordSHOULDbeCHANGED';
 
Username JMerkle

Latest revision as of 07:51, 12 June 2024

Overview

  • Create AWS account (free, but requires credit card)
  • Create an Ubuntu instance (free, as long as you select the free EC2 variant, and your account is within the "one year free" grace period)

- after 173.678 Instance Hrs, I now owe $2.36 ($0.0116 / instance hr.)

  • Install software on Ubuntu instance

Create Amazon Web Services Account and log into account Click on "EC2 Dashboard" Click on "Launch Instance" button, select Ubuntu Server 18.04 LTS Select "General purpose t2.micro Free tier eligible" Click Review and Launch After clicking on "Launch Instances", you will need to define a key pair. Provide a name for this security key pair. A security key-pair file will be downloaded. I used the name "AwsServer" Save it! This is the private key to your instance. Connect to your instance via SSH (I prefer to use TeraTerm for my SSH connection). Within your instance dashboard, for your currently running instance, find the Public DNS (IPv4) address. Example: ec2-18-237-174-213.us-west-2.compute.amazonaws.com - Follow step by step detailed below...

Connect with TeraTerm - Tera Term Download:
https://ttssh2.osdn.jp/index.html.en   or
https://download.cnet.com/Tera-Term/3000-2094_4-75766675.html
  • Select TCP/IP
  • Check History
  • TCP port #: 22
  • Service SSH, SSHVersion SSH2
  • Click "OK"
  • User Name: ubuntu (This is the initial default user name for all Ubuntu instances.)
  • Select "Use RSA/DSA/ECDSA/ED25519 key" and select the private key you downloaded earlier (Show all file types)
  • Click "OK"

Connect with Putty: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/putty.html)
Connect with Linux terminal: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AccessingInstancesLinux.html

The above steps should produce an SSH command prompt for your AWS Linux instance.

Let's perform a couple status checks...

Check available storage

[ec2-user@ip-172-31-27-115 ~]$ df
Filesystem     1K-blocks    Used Available Use% Mounted on
devtmpfs          494152      60    494092   1% /dev
tmpfs             504716       0    504716   0% /dev/shm
/dev/xvda1       8123812 1101424   6922140  14% /

Check RAM usage

[ec2-user@ip-172-31-27-115 ~]$ free
             total       used       free     shared    buffers     cached
Mem:       1009432     183080     826352         60       8864     120184
-/+ buffers/cache:      54032     955400
Swap:            0          0          0

Common Linux applications already installed in the X86 Ubuntu 18.04 instance

  • top
  • htop
  • vi
  • nano
  • ps
  • lscpu
  • lsmod
  • ifconfig
  • ping
  • nano
  • screen
  • busybox (very few, if any, sym-links to this application)
Any scripting language support?  Java: NO  Python: Yes version 2.7.18
Compilers?  cc: NO, gcc: NO

Common Linux applications already installed in the ARM Ubuntu 18.04 instance

I was expecting differences between the X86 instance and the ARM instance.
For the most part, they have been configured rather equally.
Everything found in the X86 instance was also found in the ARM instance.

Personalize your instance

Append the following on the end of .bashrc
# define current timezone so the date command reports correct local time
export TZ=CDT+5
  • Install Midnight Commander (mc)
  • Install Apache Web Server
  • Install Tight VNC Server
$ sudo yum update -y  (This will add Python 3.7.9)
$ sudo yum install httpd -y
The default document root for Apache is: /var/www/html/
The server is looking for "index.html" to use for the default web page.
Rename the current one and replace it with your own:
$ cd /var/www/html
$ sudo mv index.html index.html.bak
$ sudo cp jim.html index.html      < This assumes you have a replacement file...

A few links to get started with HTML

https://www.w3schools.com/html/default.asp 
https://colorlib.com/wp/templates/
https://www.w3schools.com/w3css/w3css_templates.asp

Shutdown (and power off) the service

$ sudo shutdown -P now

A few links for AWS:

https://aws.amazon.com/

AWS Life Cycle
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-lifecycle.html

Connecting in for the first time
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AccessingInstancesLinux.html