How Do You Troubleshoot the AWS Error “could not get token: NoCredentialProviders: no valid providers in chain. Deprecated.”

Problem scenario
You run this command: kubectl get svc

You receive this:
” could not get token: NoCredentialProviders: no valid providers in chain. Deprecated.
For verbose messaging see aws.Config.CredentialsChainVerboseErrors”

What should you do?

Solution
Install and configure the AWS CLI. If you need assistance with this, see this posting.

 » Read more..

How Do You Install pip on a RHEL Server in AWS?

Problem scenario
You want to install pip on a RedHat Enterprise Linux server in AWS.  What do you do?

Solution
Prerequisites
This assumes that Python has been installed. If it has not, run this command:
sudo yum -y install python3


Procedures

Run these two commands:
curl “https://bootstrap.pypa.io/get-pip.py” -o “get-pip.py”
sudo python3 get-pip.py # use python is python3 is not found
sudo ln -s /usr/local/bin/pip /usr/bin/pip

 » Read more..

How Do You Grant a Role The Ability to Run a Lambda Function?

Problem scenario
You have a role that you want to execute a Lambda function. What do you do?

Solution
1. Log into the AWS console.
2. Go to IAM -Roles
3. Click on the role you want to change.
4. Click on “Attach policies”
5. In the “Filter policies” field search for “lambda” with no quotes
6.

 » Read more..

How Do You Troubleshoot the boto Message “NoRegionError”?

Problem scenarios (one or both of the following are happening)
#1 You are getting “botocore.exceptions.NoRegionError: You must specify a region” when you run a Python program (that involves boto and AWS).

#2 You are trying to create a session with a Python/boto program. You are printing out the Session information in your Python program using boto but you see this:

Session(region_name=None)

What should you do?

 » Read more..

How Do You Delete a Kubernetes Cluster in AWS?

Problem scenario
You try to manually delete EC-2 instances (both worker nodes and the master node of Kubernetes), but this does not work. The EC-2 instances are re-created. How do you delete the cluster?

Solution
Prerequisite
Install and configure the AWS CLI; if you need assistance, see this posting.

Procedures
Run these three commands but substitute “contint.k8s.local” with the name of your cluster:

export KOPS_CLUSTER_NAME=contint.k8s.local
export KOPS_STATE_STORE=s3://$KOPS_CLUSTER_NAME-state
kops delete cluster –name contint.k8s.local –yes

 » Read more..

How Do You Use the AWS CLI to List Aurora Databases?

Problem scenario
You have an Amazon Aurora database in you AWS account. You want to see the status of this database with the AWS CLI. How do you list information about your Aurora databases?

Solution
Prerequisites

You must have the AWS CLI installed and configured with a user that has the ability to view Aurora databases (e.g., an administrator of your AWS account).

 » Read more..

How Do You Find the URL (or HTTP Endpoint) of a Kubernetes Cluster Running in Amazon EKS?

Problem scenario
You have a Kubernetes cluster in AWS. You have the AWS CLI installed. How do you find the URL for the Kubernetes cluster?

Solution
1. Run this command: aws eks list-clusters

2. Run this command: aws eks describe-cluster foobar # where “foobar” was name determined in above command

 » Read more..

How Do You Find what VPC an EC-2 Instance Is In?

Problem scenario
You want to determine what VPC a given AWS server is in. How do you find this out?

Solution
Prerequisite

You must have the AWS CLI installed and configured with a user that has the ability to view EC-2 databases (e.g., an administrator of your AWS account). If you need assistance, see this posting.

Procedure
Run this command: aws rds describe-db-instances | grep -i vpc

 » Read more..

How Do You Find what VPC an Aurora Database Is In?

Problem scenario
You want to be sure that a given Aurora database is in a specific VPC. How do you determine what VPC it is in?

Solution
Prerequisite
You must have the AWS CLI installed and configured with a user that has the ability to view Aurora databases (e.g., an administrator of your AWS account). If you need assistance,

 » Read more..

How Do You Use the aws update-kubeconfig Command?

Problem scenario
You want to manage your Amazon Kubernetes (i.e., EKS) cluster. You have installed the AWS CLI version on a Linux server, and you want to use the update-config or update-kubeconfig command.

But when you try you see messages like “error argument command: Invalid choice…” or “update-config: command not found”. You could not readily find an example. What should you do?

Solution
Background
The command is update-kubeconfig,

 » Read more..