Why Does “aws ssm” Return False Messages about a Package Being Installed?

Problem scenario
You run an “aws ssm” command. It returns that a given package has been installed. You know the package is not really installed. What is the reason for the discrepancy?

Solution
A previous “aws ssm” command may have run successfully. But later someone may have deleted specific files without using “aws ssm”. This is a limitation of “aws ssm”.

How Do You Fix an A Record in Active Directory That Has Two Domain Names?

Problem scenario
You added an A Record to DNS in Active Directory. You accidentally added the FQDN and the parent domain name was added. Now the A Record is too long and has a duplicative domain name like this:

server1.continualintegration.com.continualintegration.com

You tried modifying the FQDN in the A record, but it was immutable. What should you do?

Solution
Try waiting one hour.

How Do You Extract an Email Address from a CSV File?

Problem scenario
You have a CSV file with email addresses. You want to return only the email address — not lines that have an email address. What do you do?

Solution
Assuming the email addresses are in a file named email.txt, use this Python 3 program:

with open(’email.txt’, ‘r’) as a:
for b in a:
if ‘@’ in b: #operate only on lines with “@”
c = b.split() #split up words on line
for d in c: #iterate through characters of words
if ‘@’ in d: #if email address, …

How Do You Adjust the Landscape Orientation of a PDF to Be a Portrait?

Problem scenario
You have a letter 8.5 X 11 PDF. When it is opened the longest way is the width (the horizontal distance) and the shortest dimension of the PDF is the height (the vertical distance). You want it to be oriented in a more “normal” way so it shows as a portrait not as a landscape. You have a non-commercial need, and you do not want to spend any money.

How Do You Troubleshoot the SUSE Error “No curses library functions found”?

Problem scenario
In SUSE you get an error like this:

configure: error: No curses library functions found
ERROR: /bin/otp/erts/configure failed!
./configure: line 353: kill: (-13244) – No such process

What should you do?

Solution
Run this:

sudo zypper -n install ncurses-utils ncurses-devel

How Do You Find which IAM Roles Your EC-2 User Account Has?

Problem scenario
You want to see what IAM permissions a given Linux user on an EC-2 instance has. You tried going to the web console for AWS. You were unable to find the user (e.g., ec2-user or ubuntu). How do you determine which roles the user is a member of?

Solution
From the OS, run this command:
curl http://169.254.169.254/latest/meta-data/iam/security-credentials/s3access

How Do You Solve “env: ‘python’: Permission denied”?

Problem scenario
You are running a script and you receive env: “‘python’: Permission denied”

Solution
Run this: sudo ls -lhd $(which python)

Look at the permissions, file owner and group associated with the results. Consider the user that brings about the original error. You may need to change the permissions of the file.

Is the file link pointing to a directory?