Kubernetes: verifying container's health

Introduction In this post we will try to understand how to check if a container is healthy and what are the methods and patterns available in kubernetes to do so. Besides that, we will also understand the patterns kubernetes provides and when to use each of them, the patterns are process health check, liveness probe, readiness probe and startup probe. In summary, when trying to check the health of a container, we are trying to find the best method to allow kubernetes to verify if the application is running correctly....

April 16, 2024 · Caio Gomes

Using GitHub Actions to deploy a Hugo website to S3

GitHub actions is an automation service that allows us to automate all kinds of repository related processes and actions. Using GitHub Actions we provide GitHub with a yml file describing our workflow in steps, and it will run the workflow based on an event that can be a push. This way everytime we make a push to the repository it will run the actions described in the yml file with our repository....

January 15, 2023 · Caio Gomes

How to use DependsOn attribute in CloudFormation

Cloudformation is a declarative language, that means that in Cloudformation you can declare what you want and the order does not matter, it will know how to interpret what is inside the template and it will handle the right order of creation for the resources. By default Cloudformation creates all the resources in parallel, but we have some exceptions. When using the functions !Ref or !GetAtt, the resources that are dependent on other resources are created after its dependencies....

July 22, 2021 · Caio Gomes

How to use SSM parameters in CloudFormation

Parameter Store is a capability from AWS Systems Manager used to store configuration data and secrets in a easy way. It can be used as a good approach to separate data from code. One of the benefits from the Parameter Store is the possibility of referencing it from a CloudFormation template, so you can store your configuration data in Parameter Store and reference it as a parameter in CloudFormation. A parameter can be created on the console on Systems Manager -> Parameter Store -> Create a Parameter....

July 17, 2021 · Caio Gomes

How to have paramaters in an external file for CloudFormation

If you are using a reusable CloudFormation template you’ll probably want to use Parameters. Parameters are variables that you can use inside the template to input values each time you create or update a stack. This way the values are not hard-coded on the template and you can reuse it just changing the variables. If you do not specify the parameters and upload the template using the console, CloudFormation will ask each of them when creating or updating the stack and you’ll input on the console....

June 27, 2021 · Caio Gomes

Writing more pythonic code

If you like me started programming with a c-style language, like c, c++, c#, java, etc, you probably have a way to handle problems in code that resemble these languages. While this is not a problem, one of the best strengths of python is its readability and simplicity. Python provide several instruments, like using range function to iterate over for loops, list comprehension to generate lists instead of the traditional for loop approach, lambda functions, f-strings to improve string formatting, etc, to improve readability and make code clearer....

May 2, 2021 · Caio Gomes

SAM (Cloudformation) template for a serverless ETL job

Recently I had to convert a csv into a dynamodb table and my first thought was having a S3 bucket that would trigger an event for a lambda function when a file was uploaded to it. The lambda function would extract the csv data and load it into a dynamodb table. As this is a common scenario I decided to use IAAS with cloudformation, this way I would have a file that would create all the resources with all the configurations needed if I encountered the problem again....

April 27, 2021 · Caio Gomes

Linux processes

One of the major concepts that people miss when studying docker are processes. While a lot of people try to understand the difference between a container and a VM, a much more interesting question is what is the difference between a container and a process. To understand that first you need to learn what a process is, and that’s what we are going to do on this post. Think about a regular day using a computer....

August 21, 2020 · Caio Gomes

Using a bash script with sed to clean data

After creating a database the first things you will do with it are creating the schema (tables, relationships, indexes, etc) and importing data. One of the options for importing data is to import it from a flat file like txt, csv, tsv, etc. I’m developing an API now and when I imported data from a tsv (tab separated values) file Postgresql started to give errors like this in several lines:...

August 21, 2020 · Caio Gomes