Skip to content

Instantly share code, notes, and snippets.

View chris's full-sized avatar
🏠
Working from home

Chris Bailey chris

🏠
Working from home
View GitHub Profile
@chris
chris / apigateway-dynamo-vtl-template_serverless.yml
Last active November 23, 2020 18:52
Just the VTL template portion of the API Gateway - DynamoDB proxy serverless config
RequestTemplates:
application/json: |
#set($inputRoot = $input.path('$'))
{
"RequestItems": {
"${self:resources.Resources.EventsTable.Properties.TableName}": [
#foreach($event in $inputRoot.event)
{
"PutRequest": {
"Item": {
@chris
chris / apigateway-dynamo_serverless.yml
Last active December 17, 2021 05:14
Serverless Framework config file for creating API Gateway to DynamoDB proxy
service: my-api
org: CompanyName
# You can pin your service to only deploy with a specific Serverless version
# Check out our docs for more details
# frameworkVersion: "=X.X.X"
frameworkVersion: '>=2.1.1 <3.0.0'
custom:
defaultStage: dev
@chris
chris / serverless-postman-scripts.yml
Last active September 11, 2020 17:58
Serverless scripts for running Postman tests
custom:
scripts:
commands:
smoke-test-dev: "echo 'activating dev serverless DB and running dev smoke test...'; curl --request GET 'https://YOUR-API-URL' > /dev/null 2>&1; sleep 30; npm run test-dev"
smoke-test-production: "echo 'running production smoke test...'; npm run test-production"
hooks:
'after:deploy:finalize': ${self:custom.scripts.commands.smoke-test-${self:provider.stage}}
@chris
chris / amplify-url-notification.yml
Last active August 19, 2020 21:56
GitHub action to add AWS Amplify URL to PR comments and Slack
name: Amplify Branch URL notifications
on:
create:
pull_request:
types: [opened]
jobs:
add_url_comment:
name: Add Amplify deploy URL to PR comments and Slack
runs-on: ubuntu-latest
@chris
chris / aws_profile_python_config.py
Created August 7, 2020 21:57
AWS SDK configuration with role profile in Python
sess = boto3.session.Session(profile_name='mycompany_somerole_devaccount')
@chris
chris / aws_profile_go_config.go
Last active August 7, 2020 22:05
Go example for configuring AWS SDK with a role based profile
sess := session.Must(session.NewSessionWithOptions(session.Options{
Profile: "mycompany_somerole_devaccount",
SharedConfigState: session.SharedConfigEnable,
}))
@chris
chris / aws_credentials_example
Last active August 7, 2020 22:01
Example ~/.aws/credentials file using role profiles
[mycompany_myiamuser_orgaccount]
aws_access_key_id=ABCDEFGHIJKLMNOPQRST
aws_secret_access_key=abcdefghijklmnopqrstuvwxyz123566789
region=us-west-2
[mycompany_somerole_devaccount]
role_arn=arn:aws:iam::11111111111:role/OrganizationAccountAccessRole
source_profile=mycompany_myiamuser_orgaccount
[mycompany_somerole_prodaccount]
@chris
chris / circleci_config.yml
Created July 7, 2020 20:44
Example of trying to get CircleCI with Postgres, PostGIS and psql working
# Golang CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-go/ for more details
version: 2
jobs:
build:
docker:
# specify the version
- image: cimg/go:1.14
environment:
@chris
chris / github-action-postgis-psql.yml
Last active July 7, 2020 20:41
Example of GitHub action that sets up Postgres 10 and PostGIS 2.5 and uses psql
name: Test
on:
push:
paths:
- '.github/workflows/**'
- 'go/somemodule/**'
pull_request:
paths:
- '.github/workflows/**'
- 'go/somemodule/**'
@chris
chris / action-gotest-with-db.yml
Created July 7, 2020 20:22
GitHub action to run Go tests with Postgres DB URL
steps:
- name: Test Go code
working-directory: ./go/somemodule
run: go test
env:
CI_DB_URL: postgresql://postgres:password@localhost:5432/your_test_db_name