Skip to content

Instantly share code, notes, and snippets.

🐧 🗡️ 💻

Milan Thapa thapakazi

🐧 🗡️ 💻
View GitHub Profile
thapakazi / sms_via_sns_using_iam_role.txt
Last active March 24, 2023 02:57
Using IAM role to send SMS via SNS
View sms_via_sns_using_iam_role.txt
1. create sns topic
2. Under Amazon SNS > Text messaging (SMS)
Add your phone number and verify it with otp.
by default SMS is in sandbox mode:
Need to create a support ticket to "Exit SMS Sandbox" :weird: which only allows us to send sms on verified number.
set -e
exec 2>"$stderr_log"
notify() {
local exit_code=$?
local lineno=$1
if ! [ $exit_code -eq 0 ]; then
thapakazi /
Created October 26, 2022 01:42
duplicate existing secrets on aws secrets manager with prefix: /env/secret_name -> /env1/secret_name
export AWS_PROFILE=nonproduction
export AWS_REGION=us-east-1
SECRETS_DIR=/tmp/secrets && mkdir -p $SECRETS_DIR
thapakazi / Chart.yaml
Last active July 15, 2022 16:36
View Chart.yaml
apiVersion: v2
name: secret-app
description: A Helm chart for Kubernetes
type: application
version: 0.1.0
appVersion: "0.1.0"

Keybase proof

I hereby claim:

  • I am thapakazi on github.
  • I am thapakazi ( on keybase.
  • I have a public key whose fingerprint is D960 A6D6 BEC6 E198 1393 BFAB 00F2 8320 44FF 5DE8

To claim this, I am signing this object:

thapakazi /
Created December 24, 2021 06:18 — forked from Kartones/
PostgreSQL command line cheatsheet


Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
thapakazi /
Created August 19, 2021 08:06
thapakazi /
Created July 5, 2021 17:03 — forked from syntaqx/
Terraform Generate Self-Signed Certificate Files (Nginx+)
resource "tls_private_key" "ca" {
algorithm = "RSA"
resource "tls_self_signed_cert" "ca" {
key_algorithm = "RSA"
private_key_pem = "${}"
subject {
common_name = "${var.domain}"
thapakazi /
Created May 6, 2021 06:14
Session Manager / Use and configuration

Session Manager - Simplified

  • Alternative login to your ec2 instances via session manager
    • Make sure you are using vm with session manager installed
    • Your instance is attached with a iam role that has following policy attached:
      • policy_arn = “arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore”
thapakazi / CreateLambdaFunctionIAMRolePolicy.json
Created May 4, 2021 13:14
Necessary IAM policy to allow creation of lambda function
View CreateLambdaFunctionIAMRolePolicy.json
"Version": "2012-10-17",
"Statement": [
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": [