Skip to content

Instantly share code, notes, and snippets.

View daaru00's full-sized avatar
🐢

Fabio Gollinucci daaru00

🐢
View GitHub Profile
@daaru00
daaru00 / template.yaml
Last active October 3, 2022 19:24
Use EventBridge events to execute code when the CloudFormation stack itself is created
AWSTemplateFormatVersion: "2010-09-09"
Transform: "AWS::Serverless-2016-10-31"
Resources:
LogGroup:
Type: AWS::Logs::LogGroup
Properties:
LogGroupName: !Sub /aws/lambda/${StackCreatedFunction}
RetentionInDays: 7
@daaru00
daaru00 / session.mjs
Created February 22, 2024 11:55
Session management using encrypted server-only cookie
import crypto from 'crypto'
const COOKIE_NAME = 'session'
const COOKIE_GET_HEADER = 'Cookie'
const COOKIE_SET_HEADER = 'Set-Cookie'
const ENCRYPTION_ALGORITHM = 'aes-256-cbc'
/**
* Decode session from cookie header
*
@daaru00
daaru00 / template.yaml
Created March 4, 2024 08:24
API Gateway mocked API example template
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: Mocked HTTP API
Parameters:
ThrottlingRateLimit:
Type: Number
Description: The rate limit for the mock API.
Default: 1