Skip to content

Instantly share code, notes, and snippets.

@reinhrst
reinhrst / example.svg
Last active March 31, 2021 10:08
This is what you can do
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@reinhrst
reinhrst / test.svg
Created February 20, 2021 19:46
Test svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@reinhrst
reinhrst / stack.yaml
Last active October 24, 2021 14:19
Cloudformation template for static website through S3 and CloudFront
# This stack accompanies an article on my blog: https://blog.claude.nl/tech/manual/create-a-static-https-site-on-aws-with-cloudformation/
AWSTemplateFormatVersion: 2010-09-09
Description: Creates an https website
Metadata: {}
Parameters:
HostedZoneName:
Description: The HostedZoneName of the zone that you want to host the website on. This has to be in the same account, and has to be active (i.e. used as the DNS server for this domain).
Type: String
@reinhrst
reinhrst / website.svg
Last active February 19, 2021 09:22
Website diagram
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@reinhrst
reinhrst / complex.svg
Created February 18, 2021 18:33
Complex SVG
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@reinhrst
reinhrst / rechembedslogo.svg
Created February 18, 2021 18:29
Rich Embeds Logo
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@reinhrst
reinhrst / codelayer.py
Last active July 1, 2021 20:52
Custom Resource to make lambda functions with pip packages and more than 4096 bytes of code
# Code accompanying https://blog.claude.nl/tech/howto/2021/02/15/better-lambdas-with-pip-packages-in-cloudformation.html
import json
import logging
import pathlib
import re
import subprocess as sp
import sys
import tempfile
import typing as t
import shutil
@reinhrst
reinhrst / getstack.py
Created February 15, 2021 15:48
GetStack helper file
# Run as "python getstack.py #filename#", it prints a filename on stdout that contains
# the stack in #filename# with some edits
# Useful in a commandline such as:
# aws cloudformation update-stack --stack-name MyStack --template-body file://$(python getstack.py stack/stack.yaml) --parameters ParameterKey=XXXX,ParameterValue=YYYY --capabilities CAPABILITY_IAM
# The following tags are supported
# Note that all filenames used are relative to the location of the file that contains
# the filename
# All files are expected to have utf-8 encoding
@reinhrst
reinhrst / piplayer.yaml
Last active July 1, 2021 20:51
PipLayer
# Note: this snippet needs to be placed in the Resources section of a CloudFormation template
# By default this will create a layer for the python version that the custom resource lambda is running in, so if you want
# a layer for python 3.6, just replace the runtime of the PipLayerLambda.
# This gist accomanies an article on my blog: https://blog.claude.nl/tech/howto/2021/02/10/aws-lambda-python-with-packages-through-pip-in-cloudformation.html
PipLayerLambdaRole:
Type: AWS::IAM::Role
Properties:
AssumeRolePolicyDocument: