How Do You Display the VPC Peering Connections with Boto3?

Problem scenario
You want to list all the VPC Peering Connections for a specific region using Python.

You want the equivalent of aws ec2 describe-vpc-peering-connections

How do you show (retrieve or fetch) the VPC peering connections using Boto3?

Solution

import boto3
contint = boto3.client(‘ec2’)
var1 = contint.describe_vpc_peering_connections()
print(var1) …

How Do You Get Past “ImportError: No module named ‘boto'”?

Problem scenario
You want to retrieve VPC peering connection info and other VPC info via Boto3. With Python 3 you tried to run this Python 2 (and Boto 2.x) program:

import boto.vpc
c = boto.vpc.connect_to_region(‘us-east-1’)
vpcs = c.get_all_vpcs()
vpc_peering_connection = c.create_vpc_peering_connection(vpcs[0].id, vpcs[1].id)

(It was written by the person who developed Boto 2.x here.)

You have a variety or problems with the syntax not working.

How Do You Create a Customer Master Key in AWS?

Problem scenario
You want to create a CMK in Amazon web servers. What do you do?

Solution
Use Secrets Manager with Amazon’s Key Management Service.

1. Log into the AWS console.
2. Go to “Key Management Service”
3. Click on “Create key”
4. Enter an “Alias”. Normally you won’t click on the “Advanced options” unless you have a special reason.

In AWS’ KMS What Is the Difference between Administrative Permissions and Usage Permissions of a CMK?

Question
A CMK is an encryption key. In Amazon Web Services, for CMKs (Customer Master Keys) in KMS (Key Management Service), what is the difference between administrative permissions and key usage permissions?

Answer
Usage permissions enable (either IAM users or roles) to encrypt and decrypt data with the AWS KMS API.

Administrative permissions for a CMK allows either an IAM user or role to give usage permissions to other IAM users or roles through the API (and sometimes the web console).

How Do You Retrieve an Application-Level Secret from AWS?

Problem scenario
You want to obtain a non-database secret from AWS and you know the name of the secret (in Secrets Manager) and the region it is in. What should you do?

Solution
Prerequisites
You have installed and configured the AWS CLI. If you need assistance with this, click on this posting if you can use pip or this posting if you cannot use pip.

How Do You Troubleshoot the Error “Secrets Manager cannot invoke the specified Lambda function.”?

Problem scenario
You try to store a secret, but you see this message:

“Your secret was created successfully but configuring rotation has failed

Secrets Manager cannot invoke the specified Lambda function. Ensure that the function policy grants access to the principal secretsmanager.amazonaws.com. “

What do you do?

Solution
Try this posting.

How Do You Get PowerShell to Run Scripts?

Problem scenario
One of the following apply to you.

Problem scenario #1
You try a PowerShell command but you get an error like this “The ‘Login-AzureRmAccount’ command was found in the module ‘AzureRM.profile’, but the module could not be loaded.”

OR

Problem scenario #2
You try a PowerShell command but you get an error like this:

Files\WindowsPowerShell\Modules\AzureRM.profile\5.8.2\AzureRM.Profile.psm1 cannot be
loaded because running scripts is disabled on this system.