The best programming blog.

Covering a wide array of programming topics.

Install GoDaddy SSL certificate on AWS EC2 instance on Ubuntu

Get the zip of SSL certificates from GoDaddy site: _.yoursite.com.zip Contents of the zip will contain the following files: 4a…..f.crt 4a…..f.pem gd_……g1.crt Get the private key file from GoDaddy: generated-private-key.txt Copy SSL files to the folowing folder on your MAC:/Users/<YourMacMachineUserName>/SSLRename the following files: gd_bundle-g2-g1.crt > intermediate.crt 4a……7f.crt > yourdomain.com.crt generated-private-key.txt > yourdomain.com.key Generate a chained…More

Create automated snapshots of EC2 instance in AWS

Go to EC2 Dashboard home. Click on Lifecycle Manager in Elastic Block Store menu: Select EBS snapshot policy as Policy type in Create new lifecycle policy section.Click Next Step button. On the next page, add the following settings: Target resource types: Volume Target resource tags > Name > Name of your instance Description: Staging Server…More

Change support plan from Business to Basic in AWS

Navigate to thw AWS console header right hand side. Click Help icon. Click Support Center. On the next page click Change plan from the left hand side section, that will take you to Support plans page. On Support plans page click Change plan button. Click the Basic plan radio button and hit the Change plan…More

Associate Elastic IP with EC2 instance

Go to EC2 dashboard. In the left pane select Elastic IPs option under Network & Security menu. Click Allocate Elastic IP address button on the manage Elastic IP addresses page. Choose the availability zone, and click the Allocate button. You will see the Elastic IP address allocated successfully message on the next page. Click the…More

Your PHP installation appears to be missing the MySQL extension which is required by WordPress

Run the following command to fix the Your PHP installation appears to be missing the MySQL extension which is required by WordPress issue: sudo apt update sudo apt install php-mysql You will get the output like this: Unpacking php7.4-mysql (7.4.3-4ubuntu2.10) … Selecting previously unselected package php-mysql. Preparing to unpack …/php-mysql_2%3a7.4+75_all.deb … Unpacking php-mysql (2:7.4+75) … Setting…More

AWS not authorized to perform: cloudfront:ListDistributions

Error: Failed to load distributions: User: arn:aws:iam:::user/ is not authorized to perform: cloudfront:ListDistributions because no identity-based policy allows the cloudfront:ListDistributions action Solution: Create an IAM policy for accessing CloudFront resources Go to IAM dashboard. Select Users menu from the left hand side menu. Select the user you want to provide the permission. Select the permissions tab and click…More

Remove all files from a directory in Ubuntu

Following command can be used in the terminal to remove all the file and sub directories of a given folder: rm -r /var/www/myfolder/* Above var/www/myfolder/ is the full path for the directory for which the files are to be deleted.More

This IAM user does not have permission to view Log Groups in this account.

Error: This IAM user does not have permission to view Log Groups in this account.User: arn:aws:iam::…..:user/….. is not authorized to perform: logs:DescribeLogGroups on resource: arn:aws:logs:us-east-1……log-group::log-stream: because no identity-based policy allows the logs:DescribeLogGroups action Solution: Create an IAM policy for accessing CloudWatch Logs resources Go to IAM dashboard. Select Users menu from the left hand side menu. Select the…More

Add column if not exists in MySQL

SET @dbname = DATABASE(); SET @tablename = ‘YourTable’; SET @columnname = ‘YourColumn’; SET @columntype = ‘YourType’ — Example: CHAR(16) binary; SET @command = (SELECT IF( ( SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS WHERE (table_name = @tablename) AND (table_schema = @dbname) AND (column_name = @columnname) ) > 0, “SELECT 1”, CONCAT(“ALTER TABLE “, @tablename, ” ADD “, @columnname,…More