wget https://github.com/derailed/k9s/releases/download/v0.28.2/k9s_Linux_amd64.tar.gz
tar -xvzf k9s_Linux_amd64.tar.gz
./k9s
Json Web Tokens (JWTs) are base64 encoded strings. This is an example of JWT pulled from jwt.io
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c
It consists of three parts separated by a period ("."
):
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ROLE_ARN="arn:aws:iam::123456789123:role/my-role" | |
GROUP="system:masters" | |
# 1. read ".data.mapRoles" from aws-auth | |
# 2. convert it to json | |
# 3. add the role as a value to the json array | |
# 4. convert the json back to a string | |
MAP_ROLES=$(kubectl get configmap aws-auth -n kube-system -o json \ | |
| jq --arg role "$ROLE_ARN" --arg group "$GROUP" -r '.data.mapRoles | fromjson | . += [{"rolearn": $role,"groups": [$group]} ] | tojson') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo "$(date) cleaning up log groups..." | |
next_token="" | |
while true; do | |
if [[ "${next_token}" == "" ]]; then | |
response=$(aws logs describe-log-groups) | |
else | |
response=$(aws logs describe-log-groups --starting-token "$next_token") | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
next_token="" | |
RETENTION_POLICY_IN_DAYS=30 | |
echo "$(date) Starting..." | |
while true; do | |
if [[ "${next_token}" == "" ]]; then | |
echo "$(date) making api call to search for log groups.." | |
response=$(aws logs describe-log-groups --max-items 50) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import boto3, yaml, json | |
# file must in the same dir as script | |
template_file_location = 'example_cloud_formation.yml' | |
stack_name = 'test_cloud_formation' | |
# read entire file as yaml | |
with open(template_file_location, 'r') as content_file: | |
content = yaml.load(content_file) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Usage | |
# bash cert_creator.sh *.example.com | |
# | |
DOMAIN_NAME=$1 | |
echo "Starting script..." | |
echo "creating cert for $DOMAIN_NAME. Press enter to continue..." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'syslog' | |
require 'net/http' | |
require 'aws-sdk' | |
Syslog.open | |
AWS.config({ | |
:access_key_id => '<iam user key>', | |
:secret_access_key => '<iam user secret>' |