How Do You Create Angled/Italicized Quotes in Windows?

Problem scenario
In Windows you want to create italicized quotes (e.g., in Notepad or Notepad++). How do you create angled quotes (either double or single)?

Solution

All while holding alt, then press the sequence of numbers to the right, one-at-a-time to get the mark to the left:

‘ 0145
’ 0146
“ 0147
” 0148

How Do You List Valid SSM Parameters?

Problem scenario
You run an aws ssm command, but you get "InvalidParameters" in the response. You tried list-parameters, get-parameters, list-documents and other potential options in your commands. What should you do?

Solution
Run this (but replace 'us-west-2' with your region):
aws ssm describe-parameters --region us-west-2

How Do You Add Multiple DNS A Records in Active Directory Using a File?

Problem scenario
You want to create multiple A records in DNS. But to do it manually using the MMC would take too long. What should you do?

Solution

  1. Open the MMC and browse Active Directory. On the left the name of the A.D. server should be fairly obvious (e.g., contint or foobarsrv).
  2. Open PowerShell as an administrator.
  3. Create a .txt file called arecords.txt with this as the header:

name,ip

  1. Underneath that header place DNS names followed by a comma and a space, and finally the associated IP address. Have one DNS name and IP address pair per line.
  2. Change directories to where you have saved this .txt file.
  3. Run this command, but substitute contint for the name of the DNS server:
Import-Csv .\arecords.txt | foreach{Add-DnsServerResourceRecordCName -Name $_.name -ZoneName test.local -HostNameAlias $_.cname -ComputerName contint}
  1. You are done. It may take a few minutes for the DNS records to appear. This solution above was adapted from this posting.

How Do You Troubleshoot the Python Problem “SyntaxError: EOL while scanning string literal”?

Problem scenario
You are running a Python program or trying to execute a line from the Python interpreter command line. You receive this message: "SyntaxError: EOL while scanning string literal". What should you do?

Solution
Look for the double quotes and single quotes. Have they all be terminated? Are they in an even number? Was the code copied to a different workstation application and then pasted into vi or a terminal prompt? Sometimes when you paste code in MacOS or Windows, the single or double quotes become angled. Rather than have uniform courier font in a terminal, other angled quotes are possible. To learn more about italicized quotes "“”‘’" (which can be hard to see and/or detect), you can view this posting.

How Do You Write a Python Program to Print All the VPCs in Your AWS Account?

Problem scenario
You want to list all the VPCs in your account. You are using Boto3 and Python 3. What do you do?

Solution
Run this four-line program:

import boto3
client boto3.client('ec2')
response = client.describe_vpcs()
print(response)

Citation: The above was adapted from https://stackoverflow.com/questions/47329675/boto3-how-to-check-if-vpc-already-exists-before-creating-it

How Do You Troubleshoot the Ansible Error ‘”hadoop_env” is undefined’?

Problem scenario
You try to run a playbook. But you get a message like this: 'fatal: … "AnsibleUndefinedVariable" 'hadoop_env' is undefined'. What should you do?

Root cause: a variable you defined (e.g., in a playbook or role) is not getting assigned when you run the playbook.

Possible solution #1
Find the vars directory or create it. Ensure that there is a .yaml file with permissions that will allow the playbook to retrieve them and read them.

Possible solution #2
Find where your .yaml file is for vars on the server. Change your playbook to have these two lines (with "vars_file" having the same indentation as "vars:"):

vars_file:
  - /path/to/var/file.yaml

Where /path/to/var/ is the location where the YAML file named "file.yaml". This "file.yaml" file is the one defines the hadoop_env variable file.

Possible Solution #3 (not recommended)
This is just a workaround. In the playbook (or whichever file is setting your variables), go to the "vars:" section. Designate a variable like this: hadoop_env: "/"

Run the playbook again. Using "/tmp/" is possible (instead of "/"). But this may have negative security implications. As a workaround we prefer 'hadoop_env: "/"'

How Do You Use the AWS CLI to View the Targets of Routes in Route Tables in a VPC?

Problem scenario
You have a VPC with route tables. You want to search the targets to find a given value. What should you do?

Solution
As of early 2020, the output of aws describe-route-tables --filters --route-table-id abcd1234 --region us-west-2 will not include the word "target". The value of the target in the JSON output will be the ID of the given target. Targets can be Egress Only Internet Gateway, Instance, Internet Gateway, Nat Gateway, Network Interface, Outpost Local Gateway, Peering Connection, Transit Gateway, or Virtual Private Gateway. Search for those keys or the value itself; do not search for the word "target" (regardless of how it is capitalized).

How Do You Find the Make and Model of Your Laptop or Desktop Computer Running Windows?

Problem scenario
You are running Windows on your desktop or laptop. You want to find the make and model of the hardware. What do you do?

Solution

  1. Hold the Windows key down and tap the "r" key.
  2. In the command prompt type this: msinfo32
  3. Press enter.
  4. The hardware make will be found under the "System Summary" section in "System Summary".
  5. The model will be found in "System Summary" associated with the "System Model".