Skip to content

Instantly share code, notes, and snippets.

@douglampe
douglampe / vpc-nat-eip.yaml
Created November 15, 2021 23:43
CloudFormation for VPC with NAT and EIP
AWSTemplateFormatVersion: 2010-09-09
VpcCidr:
Type: String
Default: 10.192.0.0/16
PublicSubnetCidr:
Type: String
Default: 10.192.10.0/24
PrivateSubnetCidr:
Type: String
Default: 10.192.20.0/24
@douglampe
douglampe / delete-everything.sh
Created November 26, 2021 00:42
Delete all versions from an S3 bucket
aws s3api delete-objects \
--bucket ${bucket_name} \
--delete "$(aws s3api list-object-versions \
--bucket "${bucket_name}" \
--output=json \
--query='{Objects: Versions[].{Key:Key,VersionId:VersionId}}')"
@douglampe
douglampe / pipeline-snippet.yaml
Last active January 14, 2022 19:53
Create CloudFormation stack from template for branch in GitHub Action
- name: Create dev stack
run: |
aws cloudformation deploy --stack-name feature-$(echo ${GITHUB_REF##*/} | tr -cd '[a-zA-Z0-9-]') \
--template-body file://cloudformation/site-resources.yml \
--parameters ParameterKey=Environment,ParameterValue=Dev
--tags Key=environment,Value=dev
@douglampe
douglampe / authService.ts
Last active January 19, 2022 19:13
OATH2 Provider for React
import axios, { AxiosRequestConfig } from 'axios';
import jwtDecode from 'jwt-decode';
import AccessToken from '../types/AccessToken';
import AuthData from '../types/AuthData';
import IdToken from '../types/IdToken';
const getAuthData = () : AuthData =>
<AuthData>JSON.parse(window?.localStorage?.getItem('authData'));
const setAuthData = data =>
@douglampe
douglampe / pipeline-resources.yaml
Created January 22, 2022 04:03
A better SAM pipeline bootstrap template
AWSTemplateFormatVersion: '2010-09-09'
Parameters:
Environment:
Type: String
Default: Dev
Description: Environment identifier
Identifier:
Type: String
Default: StreetlightBlog