How To Create EC2 Instance In AWS With Ubuntu 18.04 And 20.04 – Step By Step Video Guide

Create EC2 Instance In AWS With Ubuntu

What is AWS EC2 Service?

AWS EC2 is a cloud-based server hosting system that is used to create on-demand servers within seconds. It allows you to create servers of various hardware configurations and your choice of the operating system.

If you’re new to AWS and wish to explore around, Amazon offers a “free tier” option to get started. Today I’ll show just how you can create an EC2 instance in AWS with Ubuntu 18.04.
That being said, true beauty lies in the simplicity Amazon AWS offers to its users to create and deploy EC2 instances on-the-fly.

Before we begin, you need to sign in and go to Services > Compute > EC2.
Scroll down a little and you should click on “Launch Instance”

Step 1: Select Amazon Machine Image

l

AMI means the operating system you want to install on your server.
There multiple options here like Ubuntu, Redhat, Windows Server but we’re just gonna stick with Ubuntu 18.04.

Step 2: Choose An Instance Type

Instance types on AWS are divided into 4 families:

  1. General Purpose
  2. Compute Optimized
  3. Memory Optimized and
  4. GPU Optimized

We’re going to select a configuration from General Purpose because it has a good balance between CPU and RAM usage.
CPU Optimized instances are fine-tuned to get maximum out of the CPU and are good for CPU intensive workloads.
Memory Optimized instances are fine-tuned to perform for memory-intensive workloads.
GPU Optimized instances have graphics processing capabilities and are useful for workloads such as animation, video editing, 3d rendering, etc.

We’re going to select “t2.micro” from General Purpose which has 1 vCPU and 1 GB RAM which should be sufficient for our demo.

Step 3: Instance Configuration

Configure EC Instance Details

Moving on, we’re just going to create one instance so I’m going to leave this and other settings as they are and go to the next step.

Step 4: Add Storage To Your Instance

Add Storage To EC2 Instance

Now, we must add storage to our instance. I’m going to add 20 GB of EBS or electronic block storage.
I’m going to keep the volume type as “General Purpose SSD” because I’m going to be using the EC2 instance as a small webserver.
You can choose “Provisioned SSD” if you plan on running intensive workloads where the number of read-write operations per second is very high.
It is mandatory to add this storage because EC2 instances don’t come with storage of its own.

EBS’ existence is independent of the core instance which makes it possible to detach a storage volume from one instance and attach it to another instance without any hassle.
You can also scale your storage size with little or no downtime.

Step 5: Add Tags (Optional)

Add Tags To EC2 Instance

This is an optional step and is particularly useful if you want to group or identify instances based on various key-value pairs.
For e.g., if you have multiple EC2 instances dedicated to a website(vikaswani.com), you can tag them with key – “website” and value “vikaswani.com”.
Tagging is useful for searching resources across AWS and not just EC2.

Step 6: View Summary and Launch

Review and Launch EC2 Instance

Next, we proceed to the summary which shows exactly what type of server we’re about to create.
Then we click on launch.

Step 7: Create SSH Private Key

Create SSH Private Key

Now, you can access your server with either username and password or with an ssh key.
I won’t recommend username and password so I’ll just continue with ssh key mainly because it provides added security and eliminates the possibility of guessing the password.
So I create a new key pair and download it.
Make sure you keep this private key safe as this is what we’ll need to access our server.
Note: The private key cannot be downloaded at a later stage.

Step 8: Log In With PuTTY

Log In With PuTTY

To log in to our server we’ll need SSH software like PuTTY.
Before we start using Putty, we need to convert the “.pem” file to “.ppk” file using PuTTYgen.
So to do that, let’s open PuTTYgen and open the “.pem” file. Now, we save the key to “.ppk” file.

Configuring PuTTY To Access AWS EC2 Instance

  1. Enter your instance’s IP address in “host name” field
  2. Select private key (.ppk file) in the field under Connection > SSH > Auth
  3. Type “ubuntu” in Connection > Data > Auto-login username
  4. Save session settings and click “OK”

EC2 Instance Console
That’s it! We’ve now logged into our server.

I hope you liked this article. If you did, please like and share it and Subscribe to my YouTube channel for more videos.

Thank you so much guys and I’ll see you in another video.

Train Maintenance App

Jupiter X Studio Template

Style never met and those among great. At no or september sportsmen he perfectly happiness attending. Depending listening delivered off new she procuring satisfied sex existence. Person plenty answer to exeter it if.

Style never met and those among great. At no or september sportsmen he perfectly happiness attending. Depending listening delivered off new she procuring satisfied sex existence. Person plenty answer to exeter it if. Law use assistance especially resolution cultivated did out sentiments unsatiable. Way necessary had intention happiness but september delighted his curiosity. Furniture furnished or on strangers neglected remainder engrossed.

Believing neglected so so allowance existence departure in. In design active temper be uneasy. Thirty for remove plenty regard you summer though. He preference connection astonished on of ye. Partiality on or continuing in particular principles as. Do believing oh disposing to supported allowance we.

Style never met and those among great. At no or september sportsmen he perfectly happiness attending. Depending listening delivered off new she procuring satisfied sex existence. Person plenty answer to exeter it if. Law use assistance especially resolution cultivated did out sentiments unsatiable. Way necessary had intention happiness but september delighted his curiosity. Furniture furnished or on strangers neglected remainder engrossed.

Believing neglected so so allowance existence departure in. In design active temper be uneasy. Thirty for remove plenty regard you summer though. He preference connection astonished on of ye. Partiality on or continuing in particular principles as. Do believing oh disposing to supported allowance we.

Style never met and those among great. At no or september sportsmen he perfectly happiness attending. Depending listening delivered off new she procuring satisfied sex existence. Person plenty answer to exeter it if. Law use assistance especially resolution cultivated did out sentiments unsatiable. Way necessary had intention happiness but september delighted his curiosity. Furniture furnished or on strangers neglected remainder engrossed.

Believing neglected so so allowance existence departure in. In design active temper be uneasy. Thirty for remove plenty regard you summer though. He preference connection astonished on of ye. Partiality on or continuing in particular principles as. Do believing oh disposing to supported allowance we.

Testimonials

Our client's concept about this work

By working with us, we can reach your goals in a short distance.

Lending CRM

Case Studies

Lending CRM

Lending CRM is a combination of a CRM and LoS for the lending industry. It helps financial institutions efficiently manage loan applications, customer follow-up, and profiles.

Features

Lead Profiling

Store, filter, and categorize leads by the entire customer and requirement details in one place.

Follow-ups Scheduling

Never miss an appointment or call with a customer by scheduling follow-up within the CRM.

Document Management

Upload and store KYC, banking and other required customer documents for every lead.

Bank Login

Add and track file in bank from login to approval and disbursement for every lead.

Bank Queries

Manage and fulfill queries and pendency raised by bank.

Automatic Reminders

Stay updated with automatic email reminders from system for follow-ups and lead updates.

Lead Timeline

Watch every lead’s progress and activities from start to end in nicely a pretty timeline.

Client Management

Further, nurture clients after disbursement for prospective cross-sales opportunities.

Email Integration

Email integration lead updates, document collection, and notifications.

Screenshots

Lending CRM is built with an aim of simplifying loan application processing.

  • The CRM manages to automate routine tasks like customer follow-ups for documentation completion.
    Seamless integrations with credit rating agencies like CRIF and Equifax makes it easier to verify customers and get a credit score.
  • Detailed customer profiling helps maintain data points like credit history, property details, and important dates like birthdays, anniversaries, etc.
  • Smart algorithms use profile data to evaluate eligibility for various products, send intelligent notifications on important dates.

Synergize?

How build a secure PHP application

[vc_row][vc_column][vc_column_text]

Disclaimer: Nothing is 100% secure and this article in no ways guarantees the security of your web application.

That being said, I would like to emphasize that even though nothing is 100% secure it is possible to make it harder for the attacker to do any harm. So in this article we’re going to look at some of the good practices to secure your PHP application.

Although it is not possible to cover the entire security aspects of securing a PHP application in a single article, I’ve tried my best to include the overall ideas that need to be implemented. Will write more detailed articles for every point in here in coming days.

[/vc_column_text][/vc_column][/vc_row][vc_row][vc_column][vc_column_text]

1. Sanitize and Validate User Inputs

In my experience majority of the attacks on PHP applications are successful only because the user inputs were not validated and sanitized. It is good to be paranoid and trust absolutely no one when it comes to accepting inputs. Not even in the admin section.

If you’re using any of the PHP frameworks like Laravel, CodeIgniter, PhalconPHP or Zend,  there are functions built in to sanitize user inputs. But if you’re building an application using core PHP, it would make sense to write a method to accept raw input string and return sanitized safe string.

Besides sanitizing the user input, perform necessary validations on input strings wherever necessary.
For e.g., ensuring email address is in the for format [email protected] and does not contain any special symbols.

Just by having proper sanitization and validation  rules in place, you can make it harder for an attacker to perform following attacks:

  • SQL Injection
  • Cross Site Scripting (XSS)
  • Cross Site Request Forgery (CSRF)

[/vc_column_text][vc_column_text]

2. Secure Query Execution

There are 2 main techniques to securely execute queries and prevent SQL injection:

a. Escape Quotes
It is important that you escape the quotes in inputs passed to the SQL query. If you’re using MySQL, you can use mysqli_real_escape_string() to get a string compatible with MySQL.

b. Prepared Statements
Prepared queries are the best way to avoid SQL injection attacks because prepared statements are like compiled templates to execute a query.
Values are passed into the compiled template and if they don’t match the placeholders in the template, SQL query fails.[/vc_column_text][vc_column_text]

3. File Permissions

Setting proper permissions and ownership to files and folders can prevent them from being accessed by unauthorized user.

  • Never ever use 777 for folders containing file uploads. Instead use 755.
  • Use 644 for all other (including php) files.

[/vc_column_text][vc_column_text]

4. File Uploads

I believe majority of the PHP applications at some point require file uploads funtionality to be implemented. For e.g., to upload profile picture of a user.

Although it may seem like a fairly simple task, it carries significant security risk if the file is not validated before storing it.

The most basic thing you can do is check if the file extension is valid for a particular file upload or not. For e.g., Only .jpg, .jpeg, .png should be allowed for profile picture and other extensions should be banned.

As a form of additional security measure, create a .htaccess file in your “uploads” folder and put the following content in it. This will prevent any PHP file inside the “uploads” from executing.

<Files *.php> deny from all </Files>[/vc_column_text][vc_column_text]

5. Regenerate Session IDs

Session Hijacking

[/vc_column_text][vc_column_text]

6. Implement Web Application Firewall

[/vc_column_text][vc_column_text]

7. Activate mod_security module for Apache2

[/vc_column_text][/vc_column][/vc_row]

Shared Hosting Vs Virtual Private Server

Web hosting comes in several different forms and packages like Cloud Hosting, Dedicated Hosting, VPS Hosting and finally the Shared Hosting. Some of them even prefer hosting websites on their home computer with a broadband connection.

The two most popular options for the consumer are Shared hosting – where one server is used to host hundreds of sites by dividing the server resources equally among them – and VPS hosting. VPS stands for “Virtual Private Server”, which has various advantages like privacy and security over Shared Hosting.

In shared hosting since all the websites are hosted on the same server, all the resources like RAM, Processor and Hard Disks gets equally divided across all websites. The problem comes when one of the hundred website starts getting affected by malicious entities like viruses. It affects all the websites on the server.

On the other hand VPS offers more privacy, slightly higher cost, but more control or more responsibility – for example, over operating systems and installed programs. VPS hosting allows you control over configuration and firewalls, but within strict limits set by the owner of the server you are on. This means that the others sharing a server with you cannot harm you too easily.

Though VPS Hosting is better than Shared Hosting I don’t mean to say that Shared Hosting is a complete disaster. It really depends on the host, for example Hostgator and Blue Host handle their servers really well, while others do better with people to take over the headache for them. For beginners who require only basic levels of bandwidth and disk space, shared hosting from a reliable service is a much more preferred option than a VPS.

There is one more risk factor involved with Shared Hosting, since one IP is shared across hundreds of sites there is a possibility that one of those hundred users is a spammer. The problem arises when search engines blacklists the IP. This can severely affect your website traffic and degrade it. Getting a dedicated IP address for your website is the only solution for this. Your host will charge you approximately $5 per month, a small price to pay. Also please consider that not even a dedicated IP will give you the security you get with a VPS system.

Finally, the conclusion I have arrived at is that shared hosting – with a well-known, reliable host – is definitely the best option for personal or small-scale users. But for people with big plans for their web presence, VPS is a long-term investment that will last for a lifetime. The additional privacy, control and scalability it offers is worth ten times its cost.

Choosing between Shared Hosting or VPS hosting is tough. Select web hosting that allows you to switch from one to another easily.

How To Choose A Web Hosting Service

Choosing a Web Hosting Service plays a vital part in a website’s success. With different providers having different plans and packages it can get really difficult for you to choose one. Let me help you with it.
There are different types of hosting – Dedicated Hosting, VPS Hosting, Shared Hosting and the most recent and popular one is the elastic Cloud Hosting.

Requirement Analysis
First step is to analyze your requirement, for eg., You want to host a blog or a single static website for promoting your business, a shared hosting with a dedicated IP would be an appropriate choice. But again if your business is a big corporation, I suggest you use a higher hosting standard like a Dedicated Server which will come with more flexible control over your server and will have higher resources compared to Shared Hosting or VPS Hosting.
If you are planning to start an e-commerce portal and have a limited budget, you can use shared hosting with a dedicated IP address and a Private SSL Certificate for more security. Shared hosting is not ideal for e-commerce since the application needs a lot of resources for functioning fast and reliably which is not offered by Shared Hosting. So I would recommend using this only if you are expecting small number of visitors per day say 150. If your number of visitors increase to a great extent, the account starts consuming more resources and once it reaches the maximum limit the hosting account gets temporarily suspended(Site is offline). Once you reach this mark(around 15 visitors/day), please upgrade to a VPS since an Offline website is not an option for an e-commerce portal.
Shared Hosting with Unlimited Bandwidth and Disk Space can also be used as an Update server for an application with small user-base.

Beware of Unlimited Hosting Plans
Now-a-days every hosting company has an Unlimited Hosting plan, but is it really Unlimited?
No! It isn’t except for bandwidth, disk space, email accounts, parked domains, addon domains and sub domains maybe even MySQL databases. Sure its an important factor but for handling all these in a truly unlimited manner requires unlimited CPU resource. The companies limit each account to only 25-30% of total resource usage. As soon as your account exceeds the number your account is suspended which makes your website unavailable to users.

Scalability
Some web applications have situation where sometimes the resources required by the application may exceed for small period of time. Now if that application is hosted on a VPS or a Dedicated Server, it is not possible to scale the server automatically at run-time i.e., without taking it offline. This is where Elastic Cloud Hosting comes to rescue. In this type of hosting, the server automatically scales as the requirement is increased or decreased and the user ends up paying only for the “actual” resource usage without any extra charge. That means if the website uses less HDD Space, Bandwidth, Memory and CPU you need to pay less and if the usage increases you need to pay a bit more than average.
Because of the flexibility that Cloud Hosting provides, its my personal favorite. It is suitable for all kinds of application from small to large.

Operating System
Operating System is the most critical part when it comes to choosing a hosting service. If you are running an ASP application I suggest you go with Windows Hosting since Linux won’t support ASP. If you are planning on hosting a static website in HTML or a dynamic PHP website, you should go with Linux as PHP/MySQL are open source technologies that run without any issues on Linux. Since you don’t need to purchase any license for the OS, its is cost effective too.
If you are buying a VPS or Dedicated Hosting and you are not familiar with Linux environment, please go with Windows since I find it very much user friendly for remote access.

Uptime
Look for an uptime guarantee of 99.9%, any downtime is bad as your site will simply not be available and you will lose visitors – maybe permanently.

Technical Support
If you experience urgent problems you want help immediately. You should therefore expect support to be available 24/7 by telephone, not just by email.

30 Days Money Back Guarantee
Not a “must have” feature to look for but if you are choosing a newly formed web hosting company look for this guarantee.

Other general features
Other general features you should look for are:
Control Panel(Cpanel/Plesk)
FTP Accounts
Shell Access
phpMyAdmin
Web Mail
SMTP/POP 3 Support
Domain Name Control Panel
File Manager

Also don’t forget to check reviews of various Web Hosting providers if you are still confused a lot.
Reviews will help you a lot in deciding which one to choose.

How to Find Geographical Location Using HTML 5

Geo locating is one of the coolest feature offered by HTML5. Its very easy to implement and helps the website owners to find the location of their visitor and server relative content. This feature doesn’t aim at endangering user’s privacy by asking to confirm their tracking. This feature’s accuracy is good when it comes to locating city but exact location within the city can’t be guaranteed.

We will be using Google Maps’ API for mapping the location. So lets get started.

The following javascript function is used for getting latitude and longitude of the user’s location.

function getLocation()

  {

  if (navigator.geolocation)

    {

    navigator.geolocation.getCurrentPosition(showPosition,showError);

    }

  else{x.innerHTML="Geolocation is not supported by this browser.";}

  }



Then the below function will display the location using Google Maps.

function showPosition(position)

  {

  var latlon=position.coords.latitude+","+position.coords.longitude;



  var img_url="http://maps.googleapis.com/maps/api/staticmap?center="

  +latlon+"&zoom=14&size=400x300&sensor=false";

  document.getElementById("mapholder").innerHTML="<img src='"+img_url+"' />";

  }



While performing this, there is also a necessity to handle errors. So we use the following function.

function showError(error)

  {

  switch(error.code)

    {

    case error.PERMISSION_DENIED:

      x.innerHTML="User denied the request for Geolocation."

      break;

    case error.POSITION_UNAVAILABLE:

      x.innerHTML="Location information is unavailable."

      break;

    case error.TIMEOUT:

      x.innerHTML="The request to get user location timed out."

      break;

    case error.UNKNOWN_ERROR:

      x.innerHTML="An unknown error occurred."

      break;

    }

  }



Entire code with HTML

<!DOCTYPE html>
<html>
<body>
<p id="demo">Click the button to find your location:</p>
<button onclick="getLocation()">Find Location</button>
<div id="mapholder"></div>
<script>
var x=document.getElementById("demo");
function getLocation()
  {
  if (navigator.geolocation)
    {
    navigator.geolocation.getCurrentPosition(showPosition,showError);
    }
  else{x.innerHTML="Geolocation is not supported by this browser.";}
  }

function showPosition(position)
  {
  var latlon=position.coords.latitude+","+position.coords.longitude;

  var img_url="http://maps.googleapis.com/maps/api/staticmap?center="
  +latlon+"&zoom=14&size=400x300&sensor=false";
  document.getElementById("mapholder").innerHTML="<img src='"+img_url+"' />";
  }

function showError(error)
  {
  switch(error.code)
    {
    case error.PERMISSION_DENIED:
      x.innerHTML="User denied the request for Geolocation."
      break;
    case error.POSITION_UNAVAILABLE:
      x.innerHTML="Location information is unavailable."
      break;
    case error.TIMEOUT:
      x.innerHTML="The request to get user location timed out."
      break;
    case error.UNKNOWN_ERROR:
      x.innerHTML="An unknown error occurred."
      break;
    }
  }
</script>
</body>
</html>

Live Demo

Best Places to Start Learning HTML 5, CSS 3, Javascript, PHP, MySQL

If you are planning to continue with Web Application programming you need to have knowledge of
1. HTML 5
2. CSS 3
3. Javascript
4. PHP  &  MySQL (My preferred language and database engine)

I am going to continue to write my most of the articles related to web application programming on PHP – MySQL pair as it is my favorite and immensely dynamic.
Lets discuss each entity’s role and importance in web application programming.

1. HTML 5
Now many of you have heard about HTML. It is used for creating web pages etc.. and probably wondering what is HTML 5? Well HTML 5 is nothing but a new and advanced version of HTML. It has got tons of new features, tags etc. If you intend to excel in web application development you must conquer HTML 5 first.
Here are a few important websites that will get you started with HTML 5.
1. Tizag.com/htmlT/
2. W3Schools.com/html5/default.asp
3. html5demos.com (An excellent website for you to checkout new features of HTML 5)
4. W3.org/TR/html5/ (A detailed reference of HTML 5 and its features)

You might also wanna buy these books that contains some quick and awesome HTML 5 hacks.
1. Pro HTML5 Programming: Powerful APIs for Richer Internet Application Development
US/UK/CA                  India
 

2. HTML5 24-Hour Trainer (Wrox Programmer to Programmer)
US/UK/CA                  India
 

2. CSS3
Just as HTML 5 is new version of HTML, CSS3 is the most recent version of CSS (Cascading Style Sheet). CSS is generally used to enhance a website’s look. It has a lot of features like animations, text color, shadows, backgrounds, transitions, custom borders and its colors etc.
Here are a few important websites that will get you started with CSS3.
1.Tizag.com/cssT/
2. W3Schools.com/css3/default.asp
3. CSS3.com

You might also wanna buy these books to know extra stuff about styling your website.
1. Basics of Web Design: HTML5 and CSS3
US/UK/CA                  India
 

3. Javascript
Javascript is a browser sided scripting language. The script is downloaded on client side and executed as the calls are made. Javascript is used to enhance the interactivity and looks of a website. It is used to create drop down menus, perform run-time calculations, update content view dynamically via AJAX(A combination of XML and Javascript to update records/views dynamically at run-time). To reduce the coding work there are many Javascipt libraries like JQuery and MooTools which help you in adding some awesome effects to your website in very less time.
You can visit the following websites to start learning Javascript.
1. Ttizag.com/javascriptT/
2. W3schools.com/js/default.asp
3.Codeacademy.com

Books that can help you learn Javascript even better.
1. Professional JavaScript for Web Developers (Wrox Programmer to Programmer)
US/UK/CA                  India
 

2. JavaScript for Absolute Beginners
US/UK/CA                  India
 

4. PHP and MySQL
PHP-MySQL is the most powerful hence most preferred solution for web based application. PHP provides powerful programming flexibility while MySQL provides us with secure, fast and reliable database management facility. PHP is very easy to understand and one can quickly learn it if he/she has learned the basics of programming by studying C and C++. With ability of numerous inbuilt functions programming a web application becomes even faster. To add to this there are various  frameworks like Code Igniter, Zend, CakePHP which reduce your programming even further since a LOT of functions are available in them too. PHP is both procedural as well as Object Oriented language. The best part is we can use it with HTML. With help of HTML+Javascript+CSS you can create a jaw-dropping look while by using PHP+MySQL with HTML you can create mind blowing PHP application.

Books for PHP and MySQL
1. Beginning PHP and MySQL: From Novice to Professional
US/UK/CA                  India
 

2. PHP Solutions: Dynamic Web Design Made Easy
US/UK/CA                  India
 

3. PHP 6: A Beginner’s Guide
US/UK/CA                  India
 

So this was pretty much I could possibly help you with basics of web application programming. I hope you complete it fast and as you complete, don’t forget to go through intermediate-advanced topics I would be discussing in my upcoming programming posts.
I hope this article helps you. Share it if you like it.
Good Luck and Thank You!!