How Do You Troubleshoot the InsufficientFreeAddressSpaceInVpc Error?

Problem scenario
You run an AWS CLI command. But you get this message:

An error occurred (InsufficientFreeAddressSpaceInVpc) when calling the CreateDefaultSubnet operation: The VPC ‘vpc-123abcd’ does not have enough free address space to allocate an additional /20 subnet.

How do you troubleshoot this AWS CLI error?

Solution
Go to the VPC section of AWS. Find the VPC in the error and click on it.

How Do You Troubleshoot the kubectl ‘version “extensions/v1beta1″‘ Error Message?

Problem scenario
You run a kubectl command, but you get this problem: ‘error: unable to recognize “foobar.yaml”: no matches for kind “Deployment” in version “extensions/v1beta1″‘

What should you do?

Solution
Change your yaml file so the apiVersion setting/value works. To learn more about the acceptable values, see this posting.

How Do You Replace a Pattern with a String in Bash?

Problem scenario
You have a .txt file. You know Linux can support substitutions of strings with some type of expression. You want to use Bash to replace every occurrence in the file with a string. What should you do?

Solution
Let’s assume the file you have is called coolfile.txt. Run these two commands to replace “foo” with “bar” every time “foo” is found in the file named coolfile.txt:

oldfile=$(cat coolfile.txt)
echo “${oldfile//’foo’/bar}” > …

How Do You Escape or Break from a Method in Python?

Problem scenario
You want to quit a function, or return out of it, when a certain condition is met. How do you do this?

Solution
This program illustrates how it is done. You will want to run the program twice, once by leaving the “5” as it is, and a second time by changing the “5” to “6”.

def cool(x):
if x == 5:
return “There was equivalence”
else:
y = x
print(“This statement is printing as an illustration”)
return “The comparison was NOT equivalent”

var1 = cool(5)
print(var1) …

How Do You Troubleshoot a C Program That Prints a Warning Message like “expects argument of type ‘int’, but argument 2 has type ‘char *’ [-Wformat=]”?

Problem scenario
You compile a C program (with gcc foobar.cc) but you get an error message like this:

basicprog.c:5:13: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘char *’ [-Wformat=]
printf (“y is a %d\n”,y);

What do you do to not get this error?

Solution
While the code compiles, the executable may not run.  A compilation error can be benign. 

How Do You Use Terraform and Kubernetes in a Simple Way (as a Proof of Concept)?

Problem scenario
You want to use Terraform and Kubernetes (in EKS). How do you do this in a simple way to test it out?

Solution
Prerequisite

This assumes you have deployed EKS. If you need assistance, see this posting.
This assumes you have installed Terraform. If you need assistance, see this posting.

Procedures

  1. This first step is optional.

How Do You Fix the AWS CLI Error “Following required service principals [eks.amazonaws.com] were not found in the trust relationships”?

Problem scenario
You run an AWS CLI command, but you get this error:

An error occurred (InvalidParameterException) when calling the CreateNodegroup operation: Following required service principals [eks.amazonaws.com] were not found in the trust relationships of clusterRole arn:aws:iam::12345678910:role/foobar

How do you fix this?

Solution
Draft a command like this (but replace “12345677810:role/foobar” with the equivalent string in the error,

A List of PowerShell Books

1593279183PowerShell for Sysadmins: Workflow Automation Made Easy by No Starch Press

1617294160Learn Windows PowerShell in a Month of Lunches by Manning Publications

1449320686Windows PowerShell Cookbook: The Complete Guide to Scripting Microsoft’s Command Shell by O’Reilly Media

1789536669Mastering Windows PowerShell Scripting: Automate and manage your environment using PowerShell Core 6.0, 3rd Edition by Packt Publishing

B085RQNL9XWindows PowerShell and Scripting for Beginners: Complete Beginners Guide to learn Windows PowerShell and its Scripting by Independently published

1617295094Learn PowerShell Scripting in a Month of Lunches by Manning Publications

0735675112Windows PowerShell Step by Step by Microsoft Press

1789808537Windows Server 2019 Automation with PowerShell Cookbook: Powerful ways to automate and manage Windows administrative tasks,

How Do You Test the “mount -a” Command to Verify Sufficient Permissions on a Linux VM?

Problem scenario
You want to test “mount -a” to verify your user has sufficient permissions. You cannot add a physical device to the Linux server. How do you confirm “mount” will work?

Solution
Create a directory to be a mount point:
sudo mkdir /aaa
Find a block device to mount. One way would be to run this: sudo cat /proc/partitions
Once found,