Skip to content

Instantly share code, notes, and snippets.

variable "firebase_admin_token" {
description = "The token to use to deploy firebase resources."
type = string
}
variable "project" {
description = "The project id to create the app for."
type = string
}
--- # apache_balancer_manager_role do.yml
- name: member_host
debug:
msg: "member_host {{ member_host }}"
- name: "Get the balancer_manager content"
uri:
url: "{{ apache.balancer.url }}"
follow_redirects: yes
return_content: yes
@nktstudios
nktstudios / AWS Lambda Function to Send Email
Created September 21, 2021 14:21
AWS Lambda Function to Send Email
import json
import boto3
def lambda_handler(event, context):
ses = boto3.client('ses')
body = """
Hello and welcome to the SES Lambda Python Demo.
jobs:
should_run:
name: should run the next job
runs-on: ubuntu-latest
steps:
- name: check if vb is the commiter
if: github.event.pusher.name != 'vibou'
run: exit 1 # the job fails if not vibou
perform_action:
name: should run the next job
@pydevops
pydevops / private-k8s.md
Last active February 2, 2024 03:25
how to set up kubectl on laptop for private GKE cluster and on prem private cluster

HTTP tunnel

On prem k8s cluster set up with bastion vm

  1. Create a bastion vm in your data center or in cloud with connectivity set up (usually vpn) to the on prem data center.
  2. Install tinyproxy on the bastion vm and pick a random port as it would be too easy for spam bot with default 8888, set up as systemd service according to https://nxnjz.net/2019/10/how-to-setup-a-simple-proxy-server-with-tinyproxy-debian-10-buster/. Make sure it works by validating with curl --proxy http://127.0.0.1:<tinyproxy-port> https://httpbin.org/ip. And I don't use any user authentication for proxy, so I locked down the firewall rules with my laptop IP/32.
  3. Download the kubeconfig file for the k8s cluster to your laptop
  4. From your laptop, run
HTTPS_PROXY=<bastion-external-ip>:<tinyproxy-port> KUBECONFIG=my-kubeconfig kubectl get nodes
@lukeplausin
lukeplausin / bash_aws_jq_cheatsheet.sh
Last active January 29, 2024 10:00
AWS, JQ and bash command cheat sheet. How to query, cut and munge things in JSON generally.
# Count total EBS based storage in AWS
aws ec2 describe-volumes | jq "[.Volumes[].Size] | add"
# Count total EBS storage with a tag filter
aws ec2 describe-volumes --filters "Name=tag:Name,Values=CloudEndure Volume qjenc" | jq "[.Volumes[].Size] | add"
# Describe instances concisely
aws ec2 describe-instances | jq '[.Reservations | .[] | .Instances | .[] | {InstanceId: .InstanceId, State: .State, SubnetId: .SubnetId, VpcId: .VpcId, Name: (.Tags[]|select(.Key=="Name")|.Value)}]'
# Wait until $instance_id is running and then immediately stop it again
aws ec2 wait instance-running --instance-id $instance_id && aws ec2 stop-instances --instance-id $instance_id
# Get 10th instance in the account
@telent
telent / gist:9742059
Last active February 19, 2024 09:30
12 factor app configuration vs leaking environment variables
App configuration in environment variables: for and against
For (some of these as per the 12 factor principles)
1) they are are easy to change between deploys without changing any code
2) unlike config files, there is little chance of them being checked
into the code repo accidentally
3) unlike custom config files, or other config mechanisms such as Java