Skip to content

Instantly share code, notes, and snippets.

View tpschmidt's full-sized avatar
🎯
Focusing

Tobias Schmidt tpschmidt

🎯
Focusing
View GitHub Profile
@tpschmidt
tpschmidt / weekly-aws-cost-report-to-slack.js
Created June 26, 2026 22:36
Weekly AWS cost report to Slack (Lambda + Cost Explorer + EventBridge)
// Weekly AWS cost report -> Slack
//
// Lambda (nodejs18.x) triggered by EventBridge every Friday 08:00 UTC:
// cron(0 8 ? * FRI *)
//
// Pulls month-to-date usage, credits (MTD + YTD) and an end-of-month
// forecast from Cost Explorer, then posts a Block Kit summary to Slack.
// Slack webhook URL is read from SSM Parameter Store (SecureString).
//
// Env:
@tpschmidt
tpschmidt / 00-README.md
Created May 28, 2026 17:49
Hardened AWS Org β€” Terraform: SCPs, EventBridge security alerts, weekly resource watchdog

Hardened AWS Org β€” Terraform

The important pieces from my weekend hardening pass. All values anonymized (account IDs, emails, usernames). Code is straight from the live setup, just stripped of identifiers.

Files

  1. 01-scps.tf β€” DenyServices (13 statements) + EnforceMFA. Region pin, instance-class allowlist, audit-tamper denies,
@tpschmidt
tpschmidt / bootstrap.sh
Created February 28, 2026 11:41
Bootstrap script for OpenClaw on AWS Lightsail with SSM Session Manager, Node.js, AWS CLI, Go, and gogcli
#!/bin/bash
set -eu
# ── SSM agent ────────────────────────────────────────────────────────────────
# We need the SSM agent for accessing Lightsail instances
if ! snap services amazon-ssm-agent | grep -q 'active'; then
snap stop amazon-ssm-agent || true
fi
/snap/amazon-ssm-agent/current/amazon-ssm-agent -register -y \
-id "${ssm_activation_id}" \
@tpschmidt
tpschmidt / set-retention.sh
Created March 1, 2024 06:18
Set Retention for all AWS CloudWatch Log Groups in all Regions
#!/bin/bash
retention_days=$1
if [ -z "$retention_days" ]; then
echo "Usage: $0 <retention_days>"
exit 1
fi
regions=$(aws ec2 describe-regions \

Hi πŸ‘‹ My name is Tobi

Cloud Specialist & Software Engineer

@tpschmidt
tpschmidt / step-function-execution-example.js
Last active June 12, 2021 09:11
Step Functions: Starting a State Machine via AWS SDK
import AWS, { StepFunctions } from 'aws-sdk'
import { v4 } from 'uuid'
import { StartExecutionInput, StartExecutionOutput } from 'aws-sdk/clients/stepfunctions'
interface StateMachineSubmission {
customerId: string
traceId: string
}
export class StateMachineService {

Keybase proof

I hereby claim:

  • I am tpschmidt on github.
  • I am tpschmidt (https://keybase.io/tpschmidt) on keybase.
  • I have a public key ASAgvPAm-OIZkHW9Ydkwa3IOb8uPqqg8TmN-OYF5Dbb-ZAo

To claim this, I am signing this object: