Resolved | Uncaught Error: Call to undefined function mysqli_connect() in /var/www/html/index.php

By | 2017-03-20T21:23:08+00:00 March 23rd, 2017|AWS, Linux, Scripts|

I was using the following PHP file to test connectivity of MySQL instance hosted on Amazon RDS. [crayon-592af9f1082db505983672/] A very basic script indeed. However when I try to browse this file from the web browser, I would get the following error. What a message to troubleshoot! Since this page was hosted on an Apache server, the first place to look for is the Apache log. Hence executed the following command to check Apache logs. [crayon-592af9f1082f0636656611/] [crayon-592af9f1082f8389298110/] This made more sense. Line 5 in my code is calling mysqli_connect() function but Apache did not recognize it. That's when I remembered that I did not install the [...]

Apache shows code instead of executing PHP!

By | 2017-03-21T11:02:36+00:00 March 20th, 2017|AWS, Linux, tools|

When I was working on configuring the PHP application to connect to the MySQL instance hosted on RDS, I encountered a strange problem. The problem did occur because of any technical reasons but because I missed an important step, thanks to juggling between different servers! Here is what I was doing. After installing PHP I wanted to ensure that it was configured correctly. To confirm that I had created testphp.php in /var/www/html with the following code in it. [crayon-592af9f10d834717511568/] When I browse the above file, if it returns full information about PHP it means that the configuration was correct. But to my surprise when I put accessed [...]

Connect to a database on RDS using PHP

By | 2017-03-20T11:30:02+00:00 March 19th, 2017|cloud, data, Scripts|

In my previous post, we created a MySQL instance on Amazon RDS. We will launch a PHP page from a EC2 instance and connect to the newly created MySQL instance. As I mentioned in the last post, I had disabled Public access to the MySQL instance as I wanted only my application to connect to it. Hence for my application to connect to the MySQL instance, first I need to allow inbound connections to port 3306 from my EC2 instance which will host the Apache server. For this I need to edit the properties of the Security Group to which the MySQL instance belongs to. The [...]

How to create a MySQL database on Amazon RDS

By | 2017-03-20T11:30:38+00:00 March 18th, 2017|AWS, data|

Amazon Relational Database Service (RDS) is a Platform as a Service (PaaS) offering by AWS. The biggest advantage of PaaS is that you just create the database and rest everything pertaining to the database (and the underlying engine) is taken care by AWS. In this post I will quickly run through the process of creating a MySQL database on RDS. On the AWS portal, click on RDS option under Database option. Among all other options select MySQL engine. Since I am creating this database for test purposes, I will select Dev/Test tier of MySQL database in the subsequent screen. In the instance specifications screen we can set the following options. [...]

How to enable Multi-Factor authentication (MFA) for AWS root account

By | 2017-03-20T11:32:11+00:00 March 16th, 2017|AWS, cloud|

In the recent times we are hearing about security breaches almost everyday. No matter how strong the system security is, there is someone who is always trying to break it. Security becomes even more important when hosting your entire infrastructure on a cloud service like AWS. As you aware in AWS, there is one root account for your subscription which has complete access to all the resources that you have created on AWS. In this post we will learn on how to add one more layer of security (aka Multi-factor authentication) to the AWS root account. First you need to logon to the AWS [...]

Introduction to NAT Instance and NAT Gateway on AWS

By | 2017-03-15T10:09:39+00:00 March 15th, 2017|AWS, cloud|

In this post I will quickly go over the Network Address Translation (NAT) Instance and NAT Gateway services available on AWS. Before I get into these services, let me try to explain what is NAT in the simplest way I can. Here is an example. I am connected to my home network. My laptop is given an IP address from the router which is valid within the local network. If my computer has to communicate with other computers on the internet, it needs to have a unique public IP address. That is where a Network Address Translation (NAT) service comes into the picture. NAT takes care of [...]

Regions and Availability Zones in AWS

By | 2017-03-15T10:03:57+00:00 March 14th, 2017|AWS, cloud|

AWS EC2 instances are hosted in data centers in locations which are spread across the world. These locations represent different geographic area and they are called as Regions. US East (Ohio), Asia Pacific (Mumbai) are some of the examples of Regions. Currently available regions in AWS can be found here. Availability zones are present in each Region. Availability zones  can be thought of as a cluster of data centers. Each Region usually has more than one Availability zones. The Availability zones in turn are interconnected through a low latency networks. These Availability Zones are physically separated in a geographical location and these are usually located in low risk flood plains. Here is a [...]

Introduction to AWS Security Groups and ACL

By | 2017-03-15T10:14:31+00:00 March 14th, 2017|AWS, cloud|

As more and more businesses are moving to the cloud, Security is gaining utmost attention. On Amazon Web Services (AWS), the Security group and Network Access Control List (ACL) provide security to the services hosted. In this post I will mention few important aspects regarding Security groups  and ACL. Security Groups Security group is a virtual firewall the controls the inbound and outbound network traffic to AWS resources. This operates at the instance level. By default all inbound connections are denied in a security group. Hence while configuring a security group, we can only allow traffic and there is no deny option. Important thing about Security Groups is [...]

Basic introduction to AWS services

By | 2017-03-15T10:21:14+00:00 March 8th, 2017|AWS, cloud|

AWS offers a wide range of services for businesses to run their workload. In this post I will try to give an high-level description of the various services provided by AWS. Storage Amazon Simple Storage Service (Amazon S3) Amazon S3 is an object store (not a file system) which enables us to store files. The maximum size of the single file that can be stored in S3 is 5 TB. Unlike traditional file system, S3 storage cannot be mounted. This is best suited for storing static files like (images, videos, HTML files) and cannot be used for hosting database related files. Amazon S3 provides 99.999999999% [...]

Resolved | AWS CLI installation fails with yaml.h file error

By | 2017-03-15T10:26:46+00:00 March 3rd, 2017|AWS, cloud, Linux, python|

While I was working on my previous post where I was installing AWS CLI on Ubuntu, I encountered the following error. Downloading six-1.10.0-py2.py3-none-any.whl Installing collected packages: awscli, PyYAML, docutils, rsa, colorama, botocore, s3transfer, pyasn1, jmespath, python-dateutil, futures, six Running install for PyYAML checking if libyaml is compilable x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c build/temp.linux-x86_64-2.7/check_libyaml.c -o build/temp.linux-x86_64-2.7/check_libyaml.o build/temp.linux-x86_64-2.7/check_libyaml.c:2:18: fatal error: yaml.h: No such file or directory #include compilation terminated. libyaml is not found or a compiler error: forcing -without-libyaml (if libyaml is installed correctly, you may need to specify the option -include-dirs or uncomment and modify the parameter include_dirs [...]