Skip to content

Instantly share code, notes, and snippets.

View thapakazi's full-sized avatar
💭
🐧 🗡️ 💻

Milan Thapa thapakazi

💭
🐧 🗡️ 💻
View GitHub Profile
@thapakazi
thapakazi / security_groups_for_pods_todo.md
Created August 19, 2021 08:06
security_groups_for_pods_todo.md
@thapakazi
thapakazi / main.tf
Created July 5, 2021 17:03 — forked from syntaqx/main.tf
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 = "${tls_private_key.ca.private_key_pem}"
subject {
common_name = "${var.domain}"
install:
ln -s $PWD/librespeed-cli.service ~/.config/systemd/user/librespeed-cli.service
systemctl --user enable librespeed-cli.service
systemctl --user start librespeed-cli.service
re-install:
systemctl --user daemon-reload
systemctl --user restart librespeed-cli.service
@thapakazi
thapakazi / jibri_cron.sh
Last active May 7, 2021 13:48
helper script for jibri on ASG
#!/bin/bash
meta_url='http://169.254.169.254'
AWS_REGION=$(curl --silent $meta_url/latest/dynamic/instance-identity/document | jq -r .region)
INSTANCE_ID=$(curl --silent $meta_url/latest/meta-data/instance-id)
ASG_NAME=$(aws autoscaling describe-auto-scaling-instances \
--instance-ids $INSTANCE_ID \
--region $AWS_REGION \
| jq -r '.[] | .[] | .AutoScalingGroupName')
@thapakazi
thapakazi / session_manager_simplified.org
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
thapakazi / CreateLambdaFunctionIAMRolePolicy.json
Created May 4, 2021 13:14
Necessary IAM policy to allow creation of lambda function
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": [
"iam:CreatePolicy",
"iam:CreateRole",
"iam:AttachRolePolicy"
xps
description: Notebook
product: XPS 15 7590 (0905)
vendor: Dell Inc.
serial: 2K14DB3
width: 64 bits
capabilities: smbios-3.2.0 dmi-3.2.0 smp vsyscall32
configuration: boot=normal chassis=notebook family=XPS sku=0905 uuid=44454C4C-4B00-1031-8034-B2C04F444233
*-core
description: Motherboard
variable date {}
variable url {}
meetup "terraform_tidbits" {
date = var.date
url = var.url
title = "Terraform Practical Tit-Bits"
description = "In this session we will explore some of the common practical tit-bits of using terraform. If you are having difficulties collaborating with your friends/co-workers due to hassles of state file management, dealing with 10s of secrets/variables, managing different infra environments; well, this session is just for you."
}
@thapakazi
thapakazi / Readme.md
Last active January 29, 2021 15:12
simple nginx pod mounting custom config file
    #create config map
    curl -sL https://git.io/Jt80f  > /tmp/site.conf
    kubectl create cm nginx-config --from-file=/tmp/site.conf -o yaml --dry-run=client
    
    #lets see it in action, will ya ? 
    kubectl create cm nginx-config --from-file=/tmp/site.conf 
    
    kubectl apply -f https://git.io/Jt8uz 
@thapakazi
thapakazi / nginx.conf
Last active January 29, 2021 14:35
dead simple and boring nginx config to redirect whaterver comes to /google to google.com/search?q=$1
server {
listen 80;
listen [::]:80;
server_name localhost;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}