Skip to content

Instantly share code, notes, and snippets.

View containerscrew's full-sized avatar
🐼

danielsdotrs containerscrew

🐼
View GitHub Profile
@containerscrew
containerscrew / kubeconfig-generator.py
Last active May 9, 2024 13:13
Create EKS kubeconfig using python and boto3
import boto3
import yaml
region = "eu-west-1" # change the region if needed
cluster_name = "XXXXX" # put your cluster name
config_output_file = "config.yml" # change the path or file name if needed
is_local = True # this script will be executed using ~/.aws/credentials file
# Initial boto3 session
session = boto3.Session(region_name=region)
@containerscrew
containerscrew / Dockerfile
Last active May 11, 2023 15:05
SOCKS server in Kubernetes
FROM docker.io/linuxserver/openssh-server:latest
# latest is not a good practice, but this is for testing purpose
RUN sed -i 's/AllowTcpForwarding no/AllowTcpForwarding yes/g' /etc/ssh/sshd_config
@containerscrew
containerscrew / lambda_stop_ec2_instance.go
Last active May 4, 2023 15:04
Stop EC2 instances with specific tag filter using Go (good idea to put it in a lambda)
package main
import (
"context"
"errors"
"github.com/aws/aws-lambda-go/lambda"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/config"
"github.com/aws/aws-sdk-go-v2/service/ec2"
"github.com/aws/aws-sdk-go-v2/service/ec2/types"