fmt in Golang - formatting I/O

fmt is one of the essential packages in Golang. fmt stands for “format.” This package allows us to format strings, print output, and interact with the standard input/output streams. In this blog post, we will explore the key functionalities of the fmt package. you can import the package as shown: import "fmt" Printing to standard output There are various functions available for printing such as fmt.Println , fmt.Print and fmt.Print Println This will print a line with a new line at the end ...

July 30, 2023 · 3 min · Suraj Narwade

Using Go modules with a Private GitHub repository

working with open-source Go modules is more straightforward, you add them in Go mod files and run Go mod commands and it just works. Recently, I came across private Go modules usage in one of my projects at work and thought of writing about it so it can help someone :) if you have only one repo then you can do export GOPRIVATE=github.com/yourorg/yourrepo If you have more than one private module, you can run the following: ...

July 28, 2023 · 1 min · Suraj Narwade

For loop in Golang

Unlike other Languages, Golang does not have multiple looping constructs. It has only one for. But, I think that’s enough to cover all the use cases, let’s see different variations of loops. Basic Loop In basic for loop, there are 3 elements, initialization: i := 1 condition: i<=5 post: i++ loop will continue to run until the postcondition is true. for i := 1; i <= 5; i++ { fmt.Println(i) } output: ...

July 27, 2023 · 3 min · Suraj Narwade

Introduction to Kubernetes Clients

In this post, we will see different Kubernetes clients, the client is something that you can use to talk to the Kubernetes cluster. Mainly, there are 3 ways to talk to a cluster: kubectl Console/Dashboard programmatically using clients The Kubernetes community maintains clients in various languages in this repo. Since Kubernetes is in Golang, a client library known as client-go is widely used. But there are clients available in other interesting languages :) ...

July 26, 2023 · 1 min · Suraj Narwade

How to manage multiple versions of Terraform?

Terraform is a popular tool for Infrastructure as a Code practice to manage Cloud Infrastructure using declarative ways. As Infrastructure grows, the number of projects grows, and there’s a fair chance that you may not have the same terraform versions among your projects. There can be various reasons for it. As a result, you may need multiple terraform versions installed on your machine, which can get a little tricky. Worry not. There’s an open-source project to solve this problem tfenv. ...

February 24, 2023 · 3 min · Suraj Narwade

Encrypting EC2 Sessions with KMS and SSM Session Managers

In a previous blog post, we have seen how to enable SSM Session for EC2 instances to ditch SSH and enable safe and secure shell access. In this blog post, we will go one step further towards security and encrypting our SSM sessions from EC2-managed nodes and the local machines of users with the help of the KMS key. Creating the KMS key To encrypt the sessions in SSM, we will first need to have the KMS key. aws kms create-key --description "SSM Session Manager Key" --origin AWS_KMS This will create a KMS key for us. ...

February 20, 2023 · 2 min · Suraj Narwade

Let's SSM, not SSH, on EC2 instances

To access EC2 instances, SSH has been the preferred way for many years. But this way has its downsides, such as managing the keypairs, etc. Recently, I came across a new safe and secure way to access instances, even from a Web browser and from the terminal, which is SSM. Let’s learn more about SSM and how to set it up. What is SSM? SSM stands for Systems Manager, a set of tools such as Session manager, State manager, patch manager, etc. ...

February 20, 2023 · 3 min · Suraj Narwade

Encrypting EC2 Sessions with KMS and SSM Session Managers

In a previous blog post, we have seen how to enable SSM Session for EC2 instances to ditch SSH and enable safe and secure shell access. In this blog post, we will go one step further towards security and encrypting our SSM sessions from EC2-managed nodes and the local machines of users with the help of the KMS key. Creating the KMS key To encrypt the sessions in SSM, we will first need to have the KMS key. aws kms create-key --description "SSM Session Manager Key" --origin AWS_KMS This will create a KMS key for us. ...

February 20, 2023 · 2 min · Suraj Narwade

How to use non-AWS S3 Compatible storage for Terraform Backend?

As we know, Terraform supports S3 as a backend to store the state in AWS. In GCS and Azure, there are equivalent solutions for object storage available. What if we want to store terraform state in our environment or on any other cloud provider? The good news is that we can do that, as all we need is S3-compliant storage. An example can be: Minio: minio is S3 compatible Opensource Object storage Civo Object store: I have already shared a blog post for the same here For this example, we will use minio: ...

February 18, 2023 · 2 min · Suraj Narwade

Building awsctl using Golang #1

A few days back, I came up with the idea of awsctl CLI which will be kubectl style and will be easy to generate information about aws resources. I decided to live stream the development of the project so that it will help beginners to understand the process and lifecycle of the OpenSource project and will help the audience to learn how to write the CLI tool. here’s the summary of first(16th Feb 2023) stream: ...

February 17, 2023 · 1 min · Suraj Narwade