My personal blog

Determine suitable EC2 instance type for Spot using Spot Advisor

EC2 Spot instance provides discount rate up-to 90% compared to normal on-demand instances price. Therefore running your fault-tolerant workloads on spot instance is one of quick ways to reduce your AWS Cost. There are several ways to provision the spot instance. We can either use EC2 Spot Fleet Request or Auto Scaling Group. AWS provides Spot Instance Advisor to help users determine which instance class is suitable to run their workloads. By looking at the Spot Instance Advisor, user can see lists of instances with least chance of interruption and also the average amount of savings. Looking at above example, we filtered instance with minimum count of vCPU and memory each 4 and 4 Gib.......

STS credential for non AWS users

Use Case We have resources in AWS Account that only accessible using AWS Credential. Thus it is required to grant credential and access to the external entity that do not have AWS account. One of the common practice is to authenticate and retrieve temporary credential from IAM Role. We can define some sort of IAM Policies and attach to the designated IAM Role, then let the entity to do sts-assume-role to it and get dynamic temporary STS credential - reference. To do that in AWS environment is effortless, but not that straightforward for external non-AWS entities. Solution and Summary We can setup AWS API Gateway + AWS Lambda that can receive HTTP request from whitelisted entities.......

Convert newline from field filtering csv

Supposed you have example.txt with following lines: random123,1245541338292,unusedField random123,755914356949,unusedField random123,1666447420906,unusedField random123,841814584100,unusedField random123,85899498045,unusedField random123,103079686442,unusedField random123,773095309528,unusedField random123,704375532464,unusedField random123,1348619892622,unusedField random123,34737697829747,unusedField You can get the second column and convert the newline into commas by invoke this command cat example.txt | awk -F ',' '{print $2}' | sed ':a;N;$!ba;s/\n/,/g' the output: 1245541338292,755914356949,1666447420906,841814584100,85899498045,103079686442,773095309528,704375532464,1348619892622,34737697829747 ......

Reduce your noise with Krisp

Recently due to COVID-19, we have to work from home. Nowadays, online conference using Google Meet or Zoom Meeting becomes our daily routine. To ensure the communications are smooth and less noisy, we need to have proper audio device that capable to do noise cancelation. You can either purchase fancy microphone or just install noise cancelation application like krisp. There will be 30 days free trial for anyone who registered using company email address. You can also get additional free 3 months license by sharing referral link to your colleagues. For MacOS users, you could easily install with brew using brew cask install krisp......

List available docker image tags in docker hub

Sometimes we need to see all available release tags of docker image and we are too lazy to open the browser. Then we can list available tags by executing below snippet. Make sure you have jq installed: #!/usr/bin/env bash usage(){ echo "Usage: $0[ -r repo ]" 1>&2 exit 0 } while getopts ":r:" options; do case "${options}" in r) repository=${OPTARG} ;; *) usage ;; esac done shift $((OPTIND-1)) curl -s https://registry.hub.docker.com/v1/repositories/${repository}/tags | jq -r '.[].name' save it as docker_tag and make sure it is executable. example: ./docker_tag -r portworx/px-dev output: .... .... .... 2.3.6 2.4.0 2.4.1-rc1 2.5.0 2.5.0.1 2.5.0.2 2.5.0.3 2.......