Skip to content

Instantly share code, notes, and snippets.

@leadelngalame1611
leadelngalame1611 / cloudwatch_queries
Created February 18, 2022 19:30
Cloudwatch Queries
fields @timestamp, @message, kubernetes.container_name
| filter log_processed.level like "ERROR"
| filter kubernetes.namespace_name like "dromedarv2"
| stats count(*) as container_name by kubernetes.container_name
| limit 2000
@leadelngalame1611
leadelngalame1611 / ec2_instance.py
Created February 13, 2022 17:26
Create EC2 Instance Boto3
import boto3
from time import sleep
REGION = 'us-east-1'
AMI_IMAGE_ID = 'ami-0fac5486e4cff37f4'
INSTANCE_TYPE = 'c5.xlarge'
DISK_SIZE_GB = 200
DEVICE_NAME = '/dev/xvda'
NAME = 'codeflex-ec2'
OWNER = 'codeflex'
const appLabel = { app: "hello-kubernetes" };
const deployment = {
apiVersion: "apps/v1",
kind: "Deployment",
metadata: { name: "hello-kubernetes" },
spec: {
replicas: 3,
selector: { matchLabels: appLabel },
template: {
@leadelngalame1611
leadelngalame1611 / install_eksctl_kind.sh
Created November 18, 2021 19:22
Install kubectl, kind, aws-iam-authenticator, eksctl and update aws
# Install kubectl
curl -sLO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
rm -f ./kubectl
# install eksctl
curl -sLO "https://github.com/weaveworks/eksctl/releases/latest/download/eksctl_$(uname -s)_amd64.tar.gz"
tar xz -C /tmp -f "eksctl_$(uname -s)_amd64.tar.gz"
sudo install -o root -g root -m 0755 /tmp/eksctl /usr/local/bin/eksctl
rm -f ./"eksctl_$(uname -s)_amd64.tar.gz"
@leadelngalame1611
leadelngalame1611 / [Keycloak] - scriptmapper
Last active November 21, 2022 07:26
[Keycloak] script mapper
/**
* Available variables:
* user - the current user
* realm - the current realm
* token - the current token
* userSession - the current userSession
* keycloakSession - the current keycloakSession
*/