Skip to content

Instantly share code, notes, and snippets.

@fizz
fizz / instructions-for-antoine.md
Last active November 21, 2025 05:18
Steps for Antoine: update KinesisAccessfordevElastic trust policy

Update trust policy for KinesisAccessfordevElastic

  1. Add the ESF Lambda role ARN to the allowlist
    • In account 150992150901, run:
      aws lambda list-functions \
        --region us-west-2 \
        --query 'Functions[?starts_with(FunctionName, `elastic-serverless-forwar-ApplicationElasticServer`)].Role' \
        --output text
@fizz
fizz / trust-policy.json
Created November 21, 2025 04:55
Update trust for KinesisAccessfordevElastic
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::150992150901:root"
},
"Action": "sts:AssumeRole",
"Condition": {
@fizz
fizz / cloudformation-debug.txt
Created November 20, 2025 22:30
CloudFormation stack debug commands
aws cloudformation describe-stack-events \\
--stack-name elastic-serverless-forwarder-QA \\
--region us-west-2 \\
--query 'StackEvents[0:20].[Timestamp,LogicalResourceId,ResourceStatus,ResourceStatusReason]' \\
--output table
aws cloudformation describe-stack-events \\
--stack-name elastic-serverless-forwarder-QA-ElasticServerlessForwarder-RN3PKVPAP516 \\
--region us-west-2 \\
--query 'StackEvents[0:20].[Timestamp,LogicalResourceId,ResourceStatus,ResourceStatusReason]' \\
@fizz
fizz / trigger-esf-kinesis-test.sh
Last active November 20, 2025 20:40
Send test continue event to ESF
#!/usr/bin/env bash
set -euo pipefail
REGION="${REGION:-us-west-2}"
FUNCTION_PREFIX="${FUNCTION_PREFIX:-elastic-serverless-forwar-ApplicationElasticServer}"
STREAM_ARN="${STREAM_ARN:-arn:aws:kinesis:us-west-2:801458782278:stream/CloudWatchLinuxOSLogs}"
log() { printf '[%s] %s\n' "$(date -u +%Y-%m-%dT%H:%M:%SZ)" "$1"; }
log "Discovering ESF Lambda"
@fizz
fizz / esf-s3-data-events.sh
Created November 13, 2025 22:28
Temporary CloudTrail for ESF S3 data events
#!/usr/bin/env bash
set -euo pipefail
ENVIRONMENT="${ENVIRONMENT:-dev}"
ACCOUNT_ID="${ACCOUNT_ID:-150992150901}"
REGION="${REGION:-us-west-2}"
CONFIG_BUCKET="pge-elastic-serverless-forwarder-config-${ENVIRONMENT,,}-${ACCOUNT_ID}"
TRAIL_NAME="esf-config-data-events-$(date +%s)"
LOG_BUCKET="pge-cloudtrail-temp-logs-${TRAIL_NAME}"
@fizz
fizz / Jenkinsfile.groovy
Created October 26, 2024 16:38 — forked from Faheetah/Jenkinsfile.groovy
Jenkinsfile idiosynchrasies with escaping and quotes
node {
echo 'Results included as an inline comment exactly how they are returned as of Jenkins 2.121, with $BUILD_NUMBER = 1'
echo 'No quotes, pipeline command in single quotes'
sh 'echo $BUILD_NUMBER' // 1
echo 'Double quotes are silently dropped'
sh 'echo "$BUILD_NUMBER"' // 1
echo 'Even escaped with a single backslash they are dropped'
sh 'echo \"$BUILD_NUMBER\"' // 1
echo 'Using two backslashes, the quotes are preserved'
sh 'echo \\"$BUILD_NUMBER\\"' // "1"
@fizz
fizz / Jenkinsfile.groovy
Created October 26, 2024 16:38 — forked from Faheetah/Jenkinsfile.groovy
Jenkinsfile idiosynchrasies with escaping and quotes
node {
echo 'Results included as an inline comment exactly how they are returned as of Jenkins 2.121, with $BUILD_NUMBER = 1'
echo 'No quotes, pipeline command in single quotes'
sh 'echo $BUILD_NUMBER' // 1
echo 'Double quotes are silently dropped'
sh 'echo "$BUILD_NUMBER"' // 1
echo 'Even escaped with a single backslash they are dropped'
sh 'echo \"$BUILD_NUMBER\"' // 1
echo 'Using two backslashes, the quotes are preserved'
sh 'echo \\"$BUILD_NUMBER\\"' // "1"
@fizz
fizz / EKS_RDS_VPC_Peering_script.sh
Created July 12, 2024 19:48 — forked from imranity/EKS_RDS_VPC_Peering_script.sh
VPC Peering Between EKS and RDS postgres
#!/bin/bash -xe
## Create a VPC Peering connection between EKS and RDS Postgres
echo """ run this script as:
./eks-rds-peering.sh
+ read -p 'Enter name of EKS Cluster: ' EKS_CLUSTER
Enter name of EKS Cluster: xolv-dev-cluster
+ EKS_VPC=eksctl-xolv-dev-cluster-cluster/VPC
+ EKS_PUBLIC_ROUTING_TABLE=eksctl-xolv-dev-cluster-cluster/PublicRouteTable
+ read -p 'Enter name of RDS: ' RDS_DB_NAME
Enter name of RDS: sfstackuat
@fizz
fizz / csv-to-json.sqlite.md
Last active March 9, 2023 07:40
convert csv to json the sqlite way

try sqlite3 for csv wrangling! it's a powerhouse for easily turning your csv files into a queryable in-memory database, and it's trivial to turn that into json, and to pipe a sql query's output into jq or into a .db file, whatever you want. here are some aliases I wrote, put them in your dotfiles somewhere:

alias csvq="sqlite3 :memory: -cmd '.mode csv' -cmd '.import /dev/stdin s3' '.mode json'"

You can see that I generically name the table "s3", cuz it's an alias I use with any csv file I'm streaming from an s3 bucket, so the table name doesn't need to be too specific. I use it like this:

aws s3 cp s3://$bucket/$key - | csvq "select * from s3" | jq '.[]' -c

"select * from table" means "give me a bunch of rows", so jq '.[]' -c turns those rows into pretty-printed compressed jsonlines. I also have an alias tsvq for tsv files. It's the same thing pretty much, except with .mode tabs instead of .mode csv alias tsvq="sqlite3 :memory: -cmd '.mode tabs' -cmd '.import /dev/stdin s3' '.mode json'"

https://giphy.com/gifs/roosterteeth-lol-barbara-dunkelman-rt-podcast-lPMBfPCJnhX9kwXxc8