Skip to content

Instantly share code, notes, and snippets.

View mattgillard's full-sized avatar

Matt Gillard mattgillard

View GitHub Profile
@mattgillard
mattgillard / awscurl.sh
Last active February 25, 2023 03:27
Sample script to curl a url passed as first argument to an AWS API Gateway configured with IAM authentication (AWS_IAM)
#! /bin/bash
AWS_ACCESS_KEY_ID="$(aws configure get aws_access_key_id)"
AWS_SECRET_ACCESS_KEY="$(aws configure get aws_secret_access_key)"
AWS_SESSION_TOKEN=$(aws configure get aws_session_token)
AWS_REGION=$(aws configure get region)
# from https://gist.github.com/slawekzachcial/fe23184124763dfb82f233b5dde2394b?permalink_comment_id=4292171#gistcomment-4292171
curl --request GET -v \
@mattgillard
mattgillard / sendmessagebatch.vtl
Last active April 2, 2023 00:22
AWS API Gateway VTL for flattening array to SendMessageBatch
## Input is like:
## curl --request POST "https://xxx.execute-api.ap-southeast-2.amazonaws.com/Prod/resource?MessageGroupId=1114" -H "Content-Type: application/json" --data-raw "{\"mykey\":[\"A\",\"B\"]}"
##
## If you get this error:
## {
## "Error": {
## "Code": "AccessDenied",
## "Message": "Access to the resource https://sqs.ap-southeast-2.amazonaws.com/123456789012/myqueue.fifo is denied.",
## "Type": "Sender"
## },
@mattgillard
mattgillard / pull-request.yaml
Created December 18, 2023 06:12
Sample cloudformation lint config for GitHub workflow
name: Pull Request workflow
on:
- pull_request
jobs:
cloudformation-linter:
runs-on: ubuntu-latest
steps:
@mattgillard
mattgillard / policy.json
Last active December 18, 2023 08:55
Sample Cloudformation Execution Role
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"ec2:Create*",
"ec2:Describe*",
"ec2:Modify*",
"ec2:Delete*",