[Solved] dial tcp: lookup proxy.golang.org: i/o timeout

If you get a timeout when trying to install go dependencies, the error may look something like this: 1 2 3 $ go get github.com/aws/aws-sdk-go/aws go: module github.com/aws/aws-sdk-go/aws: Get "https://proxy.golang.org/github.com/aws/aws-sdk-go/aws/@v/list": dial tcp: lookup proxy.golang.org: i/o timeout How to Solve the Timeout Issue when installing Go Deps 1 export GOPROXY=direct Then re-run your go get command.

How to Check Operating System in Python

If you need to check the Operating System information from Python, then you can do one of the following: Option 1 – Using the platform module 1 2 3 import platform my_os = platform.system() print("Operating System is: ",my_os) Option 2 – Using the sys module 1 2 3 import sys my_os=sys.platform print("Operating System is: ",my_os)

How to Convert Hex to Byte in Python

If you need to convert Hex to Byte in Python, then you can do one of the following: Option 1 – Using binascii 1 2 3 4 5 import binascii str_val = 'This is a test'.encode('utf-8') hex_val = binascii.hexlify(str_val).decode('utf-8') print(hex_val) Option 2 – Using bytes.fromhex() 1 2 3 hex_val = 'This is a test' print(bytes.fromhex(hex_val)) Option 3 – Using unhexlify 1 2 3 4 5 6 7 8 9 import binascii from binascii import unhexlify str_val = 'This is a test'.

[Solved] fatal: Could not read from remote repository with Git

If you receive the following error when trying to clone a Git repository: fatal: Could not read from remote repository. The full message may look something like this: 1 2 3 4 5 6 7 $ git clone [email protected]:org/repo.git Cloning into 'repo'... Bad owner or permissions on /Users/ao/.ssh/config fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists. How to solve this error 1 ssh-add ~/.

How to Install Homebrew on a Mac

Prerequisites You should have some familiarity with the Mac Terminal application since you’ll need to use it to install Homebrew. The Terminal application is located in the Utilities folder in the Applications folder. Dependencies. You need to install one other piece of software before you can install Homebew: Xcode. Install Apple’s Xcode development software: Xcode in the Apple App Store. Installation Overview Installing Homebrew is straightforward as long as you understand the Mac Terminal.

How to create an AWS EC2 instance in CloudFormation

Create an EC2 Instance in CloudFormation If you need to create an EC2 instance in CloudFormation, then you can do the following: 1 2 3 4 5 6 7 8 9 10 11 AWSTemplateFormatVersion: "2010-09-09" Resources: WebInstance: Type: AWS::EC2::Instance Properties: InstanceType: t2.nano ImageId: ami-80861296 KeyName: my-key SecurityGroupIds: - sg-abc01234 SubnetId: subnet-abc01234 You can set the Instance Name as follows: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 AWSTemplateFormatVersion: "2010-09-09" Resources: WebInstance: Type: AWS::EC2::Instance Properties: InstanceType: t2.

Understanding the Network Modes in AWS ECS

If using the EC2 launch type, the allowable network mode depends on the underlying EC2 instance’s operating system. If Linux, awsvpc, bridge, host and none mode can be used. If Windows, only the NAT mode is allowed. If using the Fargate launch type, the ‘awsvpc’ is the only network mode supported. Amazon ECS task networking The networking behavior of Amazon ECS tasks hosted on Amazon EC2 instances is dependent on the network mode defined in the task definition.

How to Enable ContainerInsights on AWS ECS from the AWS CLI

If you need to enable Container Insights for an ECS cluster, by using the AWS CLI, then you can do the following: 1 2 3 4 aws ecs update-cluster-settings --cluster <cluster-name> --settings name=containerInsights,value=enabled --region <aws_region>

AppMesh and ECS with Imported ACM certificates on Envoy Sidecar through EFS

Summary This guide showcases the ability to use imported certificates from a third party provider (e.g. Venafi) in ACM, mount them in EFS and use them as trusted sources on Envoy sidecars with applications running in ECS. AppMesh is used as a passthrough with TLS termination occurring on the application container layer. Prerequisites and limitations Prerequisites A certificate that contains the chain of domains required for the fronted service and micro-services needed.

How to Increase the disk size on a Cloud9 instance

If you need to increase the disk size of a Cloud9 instance, you can run the following script directly from the terminal in Cloud9: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 pip3 install --user --upgrade boto3 export instance_id=$(curl -s http://169.254.169.254/latest/meta-data/instance-id) python3 -c "import boto3 import os from botocore.exceptions import ClientError ec2 = boto3.

How to Get the Instance Profile attached to an AWS EC2

If you need to get the IAM Role information from the attached EC2 role directly, you can do the following: 1 2 IAM_ROLE=$(curl -s 169.254.169.254/latest/meta-data/iam/info | \ jq -r '.InstanceProfileArn' | cut -d'/' -f2)

How to Create an AWS ECR Repository in AWS CLI

If you need to create an Elastic Container Registry (ECR) Repository from the AWS CLI, you can do the following: 1 2 3 4 aws ecr create-repository \ --repository-name <repo-name> \ --image-scanning-configuration scanOnPush=true \ --region ${AWS_REGION}

How to Scale Out an AWS ECS Service

When you create the Amazon ECS service, it includes three Amazon ECS task replicas. You can see this by using the describe-services command, which returns three. Use the update-service command to scale the service to five tasks. Re-run the describe-services command to see the updated five. Step 1 – Query the desired count 1 2 3 4 aws ecs describe-services \ --cluster fargate-getting-started \ --services nginx-service \ --query 'services[0].desiredCount' Output: 3

How to Retrieve AWS ECS Cluster Information

For more information about the Amazon ECS cluster, run the following command. You will find the number of running tasks, capacity providers, and more. 1 aws ecs describe-clusters --cluster <your-fargate-cluster> Sample output: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 { "clusters": [ { "clusterArn": "arn:aws:ecs:us-east-2:123456789012:cluster/<your-fargate-cluster>", "clusterName": "fargate-getting-started", "status": "ACTIVE", "registeredContainerInstancesCount": 0, "runningTasksCount": 3, "pendingTasksCount": 0, "activeServicesCount": 1, "statistics": [], "tags": [], "settings": [], "capacityProviders": [ "FARGATE", "FARGATE_SPOT" ], "defaultCapacityProviderStrategy": [] } ], "failures": [] }

Types of communication in Amazon EKS

There are multiple types of communication in Amazon EKS environments. Lines of communication include the following: Interpod communication between containers Communication between pods on the same node or pods on different nodes Ingress connections from outside the cluster In some cases, the default Kubernetes methods are used. In other cases, specifically inter-node communication and ingress methods specific to Amazon EKS are used. Intrapod communication Containers in a pod share a Linux namespace and can communicate with each other using localhost.

[Solved] Read timeout on endpoint URL: “https://lambda.[region].amazonaws.com/2015-03-31/functions/[function-name]/invocations”

If you get the following error: 1 Read timeout on endpoint URL: "https://lambda.<region>.amazonaws.com/2015-03-31/functions/<function-name>/invocations" Then you are probably trying to use the aws cli to invoke an AWS Lambda function and it is timing out. Other than making sure to set the Lambda execution time to something much higher than it is, you also need to make sure to specify the aws cli --cli-read-timeout argument to something that will cover the execution time.

How to Remove a Passphrase from Certificate Key

If you have a Certificate Key that includes a Passphrase and you need to remove it, potentially to use it with AWS App Mesh, then you can do the following: How to Remove a Passphrase using OpenSSL Locate the Private Key Run the following command: open ssl rsa -in <original.key> -out <new.key> Enter the original passphrase for the existing key The output file <new.key> will now be unencrypted How to Verify if the Passphrase has been removed Open the file in a text editor and check the headers.

How to get Python logger to Print to std out

If you use Python’s logger as follows: 1 2 3 import logging logger = logging.getLogger() logger.setLevel(logging.DEBUG) # or logging.INFO Perhaps you want to get it to print to Standard Output (stdout), then you can do the following: Setup Logger to print to Standard Output 1 2 3 4 5 6 7 8 9 10 11 import logging logger = logging.getLogger() # logger.setLevel(logging.INFO) logger.setLevel(logging.DEBUG) handler = logging.StreamHandler(sys.stdout) handler.setLevel(logging.DEBUG) formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s') handler.

How to Convert a String to an Integer in C

If you need to convert a String to an Integer in C, then you can do one of the following: Option 1 – Use atoi() int atoi(const char *str); You can do something like this: 1 2 3 4 5 6 7 8 9 10 11 12 13 #include <stdio.h> #include <stdlib.h> #include <string.h> int main (void) { int value; char str[20]; strcpy(str,"123"); value = atoi(str); printf("String value = %s, Int value = %d\n", str, value); return(0); } Option 2 – Use strtol() long int strtol(const char *string, char **laststr,int basenumber);