Skip to content

Instantly share code, notes, and snippets.

View ran-isenberg's full-sized avatar

Ran Isenberg ran-isenberg

View GitHub Profile
@ran-isenberg
ran-isenberg / Dockerfile
Created May 10, 2025 14:11
dockerfile mcp
FROM public.ecr.aws/docker/library/python:3.13-slim
COPY --from=public.ecr.aws/awsguru/aws-lambda-adapter:0.9.1 /lambda-adapter /opt/extensions/lambda-adapter
ENV PORT=8000
# Copies requirements.txt file into the container
COPY requirements.txt .
# Installs dependencies found in your requirements.txt file
RUN pip3 install -r requirements.txt --target "${LAMBDA_TASK_ROOT}"
@ran-isenberg
ran-isenberg / appsync_input.json
Created May 1, 2025 18:56
appsync_input.json
{
"identity":"None",
"result":"None",
"request":{
"headers": {
"x-forwarded-for": "1.1.1.1, 2.2.2.2",
"user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.83 Safari/537.36",
},
"domainName":"None"
},
@ran-isenberg
ran-isenberg / appsync_events_construct.py
Last active April 30, 2025 09:17
appsync_events_construct.py
import aws_cdk.aws_logs as logs
from aws_cdk import (
aws_appsync as appsync,
)
from aws_cdk import (
aws_iam as iam,
)
from aws_cdk import (
aws_wafv2 as wafv2,
)
@ran-isenberg
ran-isenberg / handler.py
Last active May 2, 2025 12:32
handler.py
from __future__ import annotations
from typing import Any
from aws_lambda_env_modeler import init_environment_variables
from aws_lambda_powertools.event_handler import AppSyncEventsResolver
from aws_lambda_powertools.event_handler.events_appsync.exceptions import UnauthorizedException
from aws_lambda_powertools.logging import Logger
from aws_lambda_powertools.metrics import Metrics, MetricUnit
from aws_lambda_powertools.tracing import Tracer
@ran-isenberg
ran-isenberg / lambda_security_check_list.txt
Created April 18, 2025 18:30
lambda_security_check_list.txt
# ✅ AWS Lambda Security Checklist
A practical checklist to help developers write secure AWS Lambda functions—without needing to be security experts.
---
## 🔐 Input Validation
- [ ] Validate and sanitize all incoming event data at the start of the handler.
- [ ] Use strict schemas (e.g., Pydantic for Python) and whitelisting.
- [ ] Avoid relying solely on frontend validation.
@ran-isenberg
ran-isenberg / session.txt
Last active June 13, 2025 05:02
5 serverless patterns you shouldnt use (and what to do instead)
5 Serverless Architecture Patterns You Should Stop Using (And What to Do Instead)
https://www.ranthebuilder.cloud/post/five-serverless-patterns-you-shouldn-t-use
AWS Lambda Handler Cookbook:
https://github.com/ran-isenberg/aws-lambda-handler-cookbook
AWS Lambda MCP Cookbook:
https://github.com/ran-isenberg/aws-lambda-mcp-cookbook
Hexagonal Architecture:
@ran-isenberg
ran-isenberg / centralized_waf_construct.py
Created December 27, 2024 09:07
centralized_waf_construct.py
import json
from aws_cdk import (
aws_fms as fms,
aws_wafv2 as wafv2
)
from constructs import Construct
class CentralizedFirewallManagerConstruct(Construct):
def __init__(self, scope: Construct, id_: str) -> None:
@ran-isenberg
ran-isenberg / Who Needs Developers Anyway? Let Automation Build Your SaaS (Almost).txt
Last active March 18, 2025 12:48
Who Needs Developers Anyway? Let Automation Build Your SaaS (Almost)
Serverless service backend blueprint: https://github.com/ran-isenberg/aws-lambda-handler-cookbook
Deep dive into the blueprint: https://www.youtube.com/watch?v=reWSpioKaUM
Awesome Serverless Bluepirnts:
https://github.com/ran-isenberg/awesome-serverless-blueprints
Automate IAM trust open source / SaaS control plane automation Article:
https://github.com/ran-isenberg/auto-cross-account-access-service
https://aws.amazon.com/blogs/mt/serverless-governance-of-software-deployed-with-aws-service-catalog/
@ran-isenberg
ran-isenberg / main.js
Created November 16, 2024 06:54
appsync main.js
import { Amplify } from 'aws-amplify';
import { events } from 'aws-amplify/data';
// set your API endpoint and API key
Amplify.configure({
"API": {
"Events": {
"endpoint": "https://<YOUR_APPSYNC_ENDPOINT>/event",
"region": "us-east-1",
"defaultAuthMode": "apiKey",
@ran-isenberg
ran-isenberg / api_gw_websocket_api_disconnect.py
Created November 12, 2024 12:17
api_gw_websocket_api_disconnect
{
'headers': {
'Host': 'asasasas.execute-api.us-east-1.amazonaws.com',
'x-api-key': '',
'X-Forwarded-For': '',
'x-restapi': ''
},
'multiValueHeaders': {
'Host': ['asasasas.execute-api.us-east-1.amazonaws.com'],
'x-api-key': [''],