- Login to AWS
- Run an instance on AWS EC2
- Store the IP Address of the EC2 instance
- Terminal with SSH Support
- Generate a PEM file from AWS console
- Remotely connect to EC2 from your computer terminal
- One can use Babun Terminal on windows.
- Install Babun
- Check if it supports ssh
- Run ssh on Babun terminal
- Go to the folder in terminal where the PEM file is stored
- Run ls to check if PEM file is available
- Run ssh ex2-user@<ip address> -i <PEM file name>
- Go to root user by running sudo su
- Run node to check if nodejs is installed
- If nodejs is not installed then go to NodeJS website > Go to Download section > Go to Installing NodeJS via package Manager
- Based on EC2 instance select the command and copy
- Node.js v12.x:
# Using Ubuntu curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash - sudo apt-get install -y nodejs # Using Debian, as root curl -sL https://deb.nodesource.com/setup_12.x | bash - apt-get install -y nodejs
- Find the installation instructions for Ubuntu and Debian here: https://github.com/nodesource/distributions/blob/master/README.md
- Run the above command on terminal
- Run yum install nodejs
- Run node
- If you have your application on github then copy the link
- make a directory using mkdir workspace
- Run cd workspace
- Run ls
- Run git clone <paste github repo link>
- Go in the application folder
- Run cd <folder name>
- Run npm install
- Run node app.js
- Go to AWS console
- Go to EC2
- Under instances add Security Group to your instance
- Go to Inbound
- Add new rule
- TCP - 5000 - Anywhere
- Save the rule
- Type the IP address on browser and add '/5000' in front of it and run it.
- If your app is visible, then it is successful
🐍 Some mathematical functions are in-built in python. Here are some of them. Convert Decimal to Hexadecimal hex(246) Output: '0xf6' hex(512) Output: '0x200' 0x is prefix to all hexadecimal numbers in output. The number after 0x is the hexadecimal value. Convert Decimal to Binary bin(1234) Output: '0b10011010010' bin(246) Output: '0b11110110' bin(512) Output: '0b1000000000' Exponential Function pow() function is similar to num1**num2, but it comes useful when you want to execute (num1**num2)%num3. Passing three arguments to pow(), does this. pow(3,4) Output: 81 This works just like 3**4 pow(3,4,5) Output: 1 But this, works equivalent to (3**4)%5. Either of the two ways can be used. At this point I feel (3**4)%5 is better, as anybody reading the code will understand what is being done immediately. While with pow(2,3,4), the person may have to refer to documentation to understand how this function works. Absolute Value The function abs() is used ...

Comments
Post a Comment