How Do You Troubleshoot the Boto3 Error “AttributeError: ‘ec2.ServiceResource’ object has no attribute ‘terminate_instances'”?

Problem scenario
You are trying to terminate some EC-2 instances. But you see a message like this:

“AttributeError: ‘ec2.ServiceResource’ object has no attribute ‘terminate_instances'”
“AttributeError: ‘ec2.ServiceResource’ object has no attribute ‘destroy_instances'”
“AttributeError: ‘ec2.ServiceResource’ object has no attribute ‘delete_instances'”

What should you do?

Solution
Rewrite the terminate portion to look like this:

ec2.instances.filter(InstanceIds=[’i-0abcd1234′, ‘i-0wxyz9999’]).terminate()  » Read more..

How Do You Use Boto and CloudFormation to Delete a Stack?

Problem scenario
You want to delete a CloudFormation Stack with Boto. What do you do?

Solution
Run a program like this (but replace “continualstack” with the name of the stack you deployed):

import boto3
cloudf = boto3.client(‘cloudformation’, region_name=’us-west-1′, aws_access_key_id=’AKIAMNOPQRST’, aws_secret_access_key=’FOOBAR1234/ZYXWV987654′)
json_stack=open(‘lampstack.json’, ‘r’).read()
cloudf.delete_stack(StackName=’continualstack’)  » Read more..

How Do You Eliminate Old Email Settings in Mozilla Thunderbird on Windows?

Problem scenario
You keep opening Mozilla Thunderbird in Windows, and it keeps finding the old settings. You want a fresh installation. What should you do?

Solution
Overview: Totally remove Thunderbird and reinstall it.

Procedure

  1. Close Thunderbird
  2. Install CCleaner. It can be downloaded from here: https://www.ccleaner.com/ccleaner/download. (The free version will work.)
  3. Open it.

 » Read more..

How Do You Troubleshoot the Hadoop Error “ApplicationClientProtocolPBClientImpl.getApplicationReport”?

Problem scenario
You are running a Hadoop command, but you get this message:

java.net.ConnectException: Your endpoint configuration is wrong; For more details see: http://wiki.apache.org/hadoop/UnsetHostnameOrPort, while invoking ApplicationClientProtocolPBClientImpl.getApplicationReport over null after 3 failover attempts. Trying to failover after sleeping for 22088ms.
2020-12-20 18:54:36,679 INFO ipc.Client:

What should you do?

Possible Solution
Is Resource Manager running? Start a new terminal and run “jps” to find out.

 » Read more..

How Do You Determine the GitHub Enterprise URL for the API Endpoint?

Problem scenario
You want to run some curl commands to invoke a GitHub Enterprise URL. You tried using “https://api.github.foobar.com/…”, but you get a message about the URL not resolving. How can you find out what the API endpoint is?

Possible Solution
Try “https://github.foobar.com/api/v3/…” instead. Although Github.com uses the “api” immediately after the “https://” constructor (and to the left of the “github…” section),

 » Read more..

How Do You Write a Python Program to Find if The “Read more” Preview on a Web Page is Visible for Every Web Page Previewed?

Problem scenario
Sometimes the “Read more” hyperlink the page preview of your website (e.g., when you search for a word), is not visible. You know that some of your web page previews on your website don’t have the “Read more” hyperlink at the end. This makes the preview appear to have the entire web page. You need to identify the postings that don’t have the “Read more.” How do you use Python to find the pages that have previews that have no “Read more” hyperlink?

 » Read more..