How to Use AWS DynamoDB with Go: A Practical Guide with Localstack

golang docker aws dynamodb localstack

Introduction AWS DynamoDB is a highly scalable, fast, and flexible NoSQL database that is a great choice for applications that require low latency and high throughput. In this tutorial, we will show you how to use AWS DynamoDB with Go and localstack to test our code. This guide will provide you with practical examples and explanations that will make it easy for you to use DynamoDB in your Go applications.

Guide to Building AWS Lambda Functions with Go and Docker

golang docker aws lambda

Introduction AWS Lambda is a powerful serverless computing platform that allows developers to run their code without worrying about the underlying infrastructure. In this tutorial, we will explore how to build and deploy AWS Lambda functions using Go and Docker. We will start by creating a new Lambda function in the AWS Management Console, then write some Go code to implement our function. We will then use Docker to build a container image of our code and deploy it to AWS.

Implement Go version manager

development golang

Introduction In this post, we will learn more about Go programming language by implementing a Go version manager CLI tool. The goal of this CLI tool is to manage different versions of Go installed on our development machine. As part of implementing the tool, we will learn about command-line flags, bash completion, HTTP client to download archives and interaction with files or directories. Let’s dive into the requirements and the features we will support with the tool and the implementation of the tool using Go.

Implementing mTLS in Go

development golang microservices

Introduction Mutual authentication with Transport Layer Security (mTLS) is a method for mutual authentication. It is often used in securing network communication between two services and ensures that the parties at each end of this communication are who they claim to be by verifying that they both have the correct private key. It has been a standard security and authentication mechanism in a service mesh like Istio, Linkerd, AWS App Mesh and others.

Union Find in Python

algorithms python

Introduction According to Wikipedia, dynamic connectivity structure is a data structure that dynamically maintains information about the connected components of a tree. Once the the dynamic connectivity structure is built, it should adapt itself such that it can give quick answers to queries of the form “is there a path between x and y?”. The Union-Find algorithm is one approach build this connectivity structure. There are multiple approaches the Union-Find algorithm, the most optimal approach is the Weighted Quick Union algorithm.

Background Tasks in Go

development golang workers

When you design a software system or REST API, there are times when you would want to process large amounts of data or do time consuming computations that cannot be completed within a decent amount of time. You cannot expect your users to make an HTTP call that takes several seconds or minutes to respond while the backend server handles the request by doing some time consuming task. Often the load balancer or the HTTP server will enforce a timeout for a request after which the connection is terminated and results in a gateway timeout error.

Ways to Rate Limit Requests in Go

development golang

Introduction Layer 7 DDoS attacks are quite common these days. With a simple script, any one can send thousands of requests to services to exhaust server resources. They can easily take down services and cause disruptions to a business. It is wise to implement strategies to mitigate such attacks using techniques that limit the number of requests a person can send to the service. It is possible to rate limit the user requests by IP address or a user ID, if available, although the former is more popular.

Implement tail command in Python

algorithms python

Introduction In this article, we will write a simple implementation of the tail command from Linux. This program will take a file and an integer n as input and print the last n lines from the file. Also, the goal of the program is to not read the entire file into memory at once. This will make the program memory efficient when dealing with very large files. Implementation Details In order to implement this program, we will use queue data structure.

Strings in Go

golang

String Types In Go, a string value is a sequence of bytes. A string value could be empty and the number of bytes is called the length of the string and is never negative. Strings are immutable: once created, it is impossible to change the contents of a string. The predeclared string type is string; it is a defined type. Normally, the length of a string s can be discovered using the built-in function len.

Vanity URL for Go packages

development golang

Introduction If you have been working with Go programming language for a while, you would have noticed that a lot of open source packages that you import start with github.com/…. You would then use go get command to download the package and add it to your go.mod file. For instance: $ go get -u github.com/abvarun226/goiplookup What if you did not want this dependency on Github and rather wanted to host your own git server?

Microservices and cloud native development using Micro

development golang microservices

Introduction For the past few years, Microservices has been all the rage and it has helped a lot of organizations to adopt continuous delivery and evolve its technology stack. There are quite a few programming tool kits and platforms that have sprung up to enable building Microservices. One among them is Micro, which is a cloud native development platform that addresses the key requirements for building services in the cloud. In their latest version v3, Micro provides service discovery, pub/sub, transport protocols and many other features out of the box.

Using Ristretto to cache objects in Go

development golang cache ristretto

Introduction In my previous article on Greycell, I wrote about caching objects using tags and how it can make cache invalidation easier. I used Redis as a temporary store for our objects that needed to be cached. Although Redis is really good for this, I wanted an embedded key-value store in order to avoid additional dependency of maintaining a Redis server. When I explored further, I came across many embedded key-value store like groupcache, fastcache, burrow cache and Dgraph’s Ristretto.

Validate email address in Go

development golang email

Firstly, based on the RFC 3696 Errata 1690, a valid email address has a maximum of 254 characters. Here is the relevant snippet from the RFC: A valid email address has a maximum of 64 characters in the “local part” (before the “@") and a maximum of 255 characters in the domain part (after the “@") for a total length of 320 characters. However, there is a restriction in RFC 2821 on the length of an address in MAIL and RCPT commands of 254 characters.

Caching records by tags in Go

development golang cache

Cache Invalidation When frequently accessed data which is stored in a cache is updated, it is necessary for the application to evict the stale data from the cache. So when subsequent requests for the same data is received by the application, it will retrieve fresh data from the database and store it in the cache. This way, users will never receive stale data from the application. The process of cache invalidation can be made easier by tagging data with specific tags when storing in the cache.

Validate Tor IP Address in Go

development golang tor

Tor Network Tor is a free and open-source software that enables anonymous communication. It directs Internet traffic through a free, worldwide, volunteer overlay network to conceal a user’s location and usage from anyone conducting network surveillance or traffic analysis. It has helped protect the personal privacy of its users and enabled the ability to conduct confidential communication by keeping their Internet activities unmonitored. Tor protect’s a user’s privacy, but does not hide the fact that someone is using Tor.

Counting Sort in Python

algorithms python

Comparison Model In computer science, sorting a list of items is a very basic as well as an important problem, that is discussed in some great detail. We basically start by using some of the simplest and intuitive techinques to sort items, like Bubble sort or Insertion sort, which are not very efficient. By efficiency, I mean their runtime is very large for very large list of items. These basic algorithms have a time complexity of O(n^2).

Multipart Requests in Go

development golang

MIME and Multipart Multipurpose Internet Mail Extensions (MIME) is an internet standard that extends the format of emails to support non-ASCII character sets, messages with multipart parts and non-text attachments like images, video, binary files etc. Multipart originates from MIME and a multipart message is a list of parts. Each part contains headers and a body. The MIME standard defines various multipart messages subtypes like mixed, digest, related, form-data, byteranges, encrypted and a few others.

About

Bharghava Varun Ayada is a Staff Software Engineer at Walmart Labs, living in Bangalore, India. This blog is about software engineering, system design, distributed systems and DevOps.


Github / Twitter / LinkedIn / Dev.to / Stackoverflow


Recommended Books
Designing Data-Intensive Applications / Staff Engineer / Building Microservices / Site Reliability Engineering

Get new posts by email