How Do You Connect to an Aurora MySQL Database from a Linux Server with a MySQL Command?

Problem scenario
You are using an Aurora or RDS MySQL database. You have a Linux server that you want to run MySQL commands from (rather than install a SQL front-end). What should you do?

Solution

1. Install a MySQL client. If you need assistance with this, see this posting.

2. Make sure the Security Group governing the Aurora or RDS region allows for incoming connections from one of the following:
a) if you are using an EC-2 server in the same region,

How Do You Write a Python Program to Show the Status of the Servers in AWS?

Problem scenario
You want to list the statuses of each EC-2 instance in AWS using Python. How do you do this for a given region in AWS (e.g., us-west-1)?

Solution
Prerequisites
This assumes you have installed Boto3. If you do not know how, see this posting “How do you install Boto 3 on a RHEL server in AWS?

How Do You Troubleshoot the Java Program Message “com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: Unknown database foobar”?

Problem scenario
Your Java program returns this message: “com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: Unknown database foobar”

What should you do?

Possible solution #1
Are you using Amazon Aurora? AWS has a MySQL PaaS offering. You may have a section of the Java code that looks like this:

Connection con=DriverManager.getConnection(“jdbc:mysql://foobar-us-west-2b.abcdefghijk.us-west-2.rds.amazonaws.com:3306/foobar”)

Remove the last “foobar” from the end. The connection string should look like this for Aurora databases:

jdbc:mysql://foobar-us-west-2b.abcdefghijk.us-west-2.rds.amazonaws.com:3306/foobar

Recompile the program.

How Do You Set up a Send-Only (Postfix) Email Server on a Linux RHEL AWS Instance?

Problem scenario
You have a monitoring tool on a RedHat Enterprise Linux server that needs to send out emails upon certain events happening. You want to install and configure an email server. You need to send outbound emails, but you do not need to receive inbound emails. How do you configure RHEL to be able to send out regular emails over the internet?

Prerequisite
This assumes that Postfix has been installed.

How Do You Delete VM Instances from GCP That Pertain to GKE?

Problem Scenario
You have some GKE standard clusters that you want deleted. You try to delete them, but they do not go away. What should you do?

Solution
Root cause: Kubernetes clusters are self-healing. They are acting as they were designed. Once the instance group is deleted, you will be able to delete the instances via the web UI or via Google’s Cloud Shell.

How Do You Get Azure PowerShell Commands Involving Storage to Work when They Are Returning an Error “not recognized”?

Problem scenario
Many Azure commands are failing. You installed the Azure module. But commands related to “Azure Storage” all return “not recognized as the name of a cmdlet, function, script file or operable program.”

You see messages like this:

New-AzureStorageAccount : A parameter cannot be found that matches parameter name ‘ResourceGroupName’.
At line:4 char:25
+ New-AzureStorageAccount -ResourceGroupName “contIntGroup” -AccountNam …
+ ~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [New-AzureStorageAccount], …

How Do You Use a PowerShell Command to Stop an Azure VM?

Problem scenario
You have a server in Azure you want to turn off. What should you do to stop it?

Solution
Prerequisite
You need to know the server’s name and resource group. You can do this by finding the server in the Azure Portal.

Procedures
Run this command:

Stop-AzureRmVM -ResourceGroupName $nameOfResourceGroup -Name $nameOfVM

# Replace $nameOfResourceGroup with the name of the Resource Group. …

How Do You Use a PowerShell Command to Destroy an Azure VM?

Problem scenario
You have a server in Azure you no longer need. You want to save money by deleting it. What should you do to eliminate it?

Solution
Prerequisite
You need to know the server’s name and resource group. You can do this by finding the server in the Azure Portal.

Procedures
Run this command:

Remove-AzureRmVM -ResourceGroupName $nameOfResourceGroup -Name $nameOfVM

# Replace $nameOfResourceGroup with the name of the Resource Group. …

How Do You Troubleshoot the Message “ModuleNotFoundError: No module named ‘awscli'”?

Problem scenario
You try to run an AWS CLI command. But you receive this error:

‘ File “/bin/aws-cli-1.16.226/bin/aws”, line 19, in
import awscli.clidriver
ModuleNotFoundError: No module named ‘awscli’

Solution
Did you run sudo python3 setup.py install ? If you only ran the build step, this could happen.