Skip to content

Instantly share code, notes, and snippets.

View singledigit's full-sized avatar

Eric Johnson singledigit

View GitHub Profile
@singledigit
singledigit / Data Source.json
Created May 7, 2021 04:34
AppSync HTTP resolver - StartSyncExecution for StepFunctions express workflows
{
"apiId": "xxxxxxxxxxxxxxxxxxxxxxxxxx",
"name": "sync_step_function",
"description": "step function test",
"type": "HTTP",
"serviceRoleArn": "arn:aws:iam::xxxxxxx:role/appsync-step-function",
"httpConfig": {
"endpoint": "https://sync-states.us-east-2.amazonaws.com",
"authorizationConfig": {
"authorizationType": "AWS_IAM",
@singledigit
singledigit / README.md
Last active September 27, 2022 17:18
AWS SAM direct integration of API Gateway REST to Amazon SQS

Instructions

  1. Drop both these files in the same folder.
  2. Deploy using AWS SAM
sam deploy --guided
@singledigit
singledigit / Auth Class
Last active October 3, 2022 18:00
Pattern for using Cognito User Pools as authentication against Cognito Identity
import {inject} from 'aurelia-framework';
import {Session} from './session';
@inject(Session)
export class Auth {
// App specific
userPoolId = 'us-east-1_fgCWraBkF';
appClientId = '57lq262n28o7ddt8i36jcjj7qd';
@singledigit
singledigit / handler.py
Last active February 24, 2023 06:04
boto sigv4 in python with Lambda
import boto3
import json
import requests
from requests_aws4auth import AWS4Auth
def lambda_handler(event, context):
signature = get_signature()
return fetch(signature)
def get_signature():
@singledigit
singledigit / gist:cfcd8bc6a1ed421c6b6b1196f189931d
Created April 5, 2023 15:32
Non-proxy catch all endpoint
openapi: "3.0.1"
info:
title: "vtl-example"
version: "1.0"
servers:
- url: "https://r5aji4fod4.execute-api.us-west-2.amazonaws.com/{basePath}"
variables:
basePath:
default: "/Prod"
paths:
@singledigit
singledigit / get-vars.py
Last active April 12, 2023 14:13
Get all env variables for all AWS Lamda functions in a CloudFormation/SAM stack
#! /usr/bin/env python
# Use at your own risk and reward.
# requires boto3 to be installed
# example `./get-vars.py MyStack > vars.json`
import sys, json
import boto3
if len(sys.argv) == 1:
@singledigit
singledigit / cognito.yaml
Last active January 16, 2024 16:15
Create a Cognito Authentication Backend via CloudFormation
AWSTemplateFormatVersion: '2010-09-09'
Description: Cognito Stack
Parameters:
AuthName:
Type: String
Description: Unique Auth Name for Cognito Resources
Resources:
# Creates a role that allows Cognito to send SNS messages
SNSRole:
@singledigit
singledigit / Install-AWS-SAM.sh
Last active April 9, 2024 12:48
Install AWS SAM on Linux using the new Linux installer
curl -L https://github.com/aws/aws-sam-cli/releases/latest/download/aws-sam-cli-linux-x86_64.zip -o aws-sam-cli-linux-x86_64.zip
unzip aws-sam-cli-linux-x86_64.zip -d sam-installation
sudo ./sam-installation/install
where sam
sam --version
@singledigit
singledigit / SAM-Lambda-Layer.yaml
Last active April 22, 2024 16:03
How to create and manage a Lambda Layer using AWS SAM
## Manage your Lambda layer in SAM
## This creates a layer and the permissions for the layer. This particular permission opens it to the world.
## I then use 'sam package' and 'sam deploy' to create/update the layer
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: Lambda Layer
Resources:
MyLayer: