This shows how to convert a basic REST ApiGateway template to its equivalent HTTP ApiGatewayV2.
The original code before refactoring to ApiGatewayV2 comes from this article
Replace MY_PROFILE
, MY_REGION
and MY_STACK_NAME
#!/usr/bin/env python3 | |
""" | |
Provides a simple Python wrapper for invoking an API Gateway endpoint using IAM signed requests. | |
Example: | |
python3 apigateway-invoke.py GET \ | |
https://xxxxxxxxxx.execute-api.us-east-1.amazonaws.com/default/MethodName | jq . | |
""" | |
try: |
#!/usr/bin/env python | |
""" | |
mocking requests calls | |
""" | |
import mock | |
import unittest | |
import requests | |
from requests.exceptions import HTTPError |
# ssh key generator data source expects the below 3 inputs, and produces 3 outputs for use: | |
# "${data.external.ssh_key_generator.result.public_key}" (contents) | |
# "${data.external.ssh_key_generator.result.private_key}" (contents) | |
# "${data.external.ssh_key_generator.result.private_key_file}" (path) | |
data "external" "ssh_key_generator" { | |
program = ["bash", "${path.root}/../ssh_key_generator.sh"] | |
query = { | |
customer_name = "${var.customer_name}" | |
customer_group = "${var.customer_group}" |
#!/bin/bash -x | |
#Date: 21/7/2017 | |
#Author: Mohan | |
#Purpose: To upload files to AWS S3 via Curl | |
#Uploads file at the top level folder by default | |
#S3 parameters | |
S3KEY="XXXXXXXXXXX" | |
S3SECRET="XXXXXXXXXXXXXXXX" |
{ | |
"APIGatewayServiceRolePolicy": { | |
"Arn": "arn:aws:iam::aws:policy/aws-service-role/APIGatewayServiceRolePolicy", | |
"AttachmentCount": 0, | |
"CreateDate": "2019-10-22T18:22:01+00:00", | |
"DefaultVersionId": "v6", | |
"Document": { | |
"Statement": [ | |
{ | |
"Action": [ |
This shows how to convert a basic REST ApiGateway template to its equivalent HTTP ApiGatewayV2.
The original code before refactoring to ApiGatewayV2 comes from this article
Replace MY_PROFILE
, MY_REGION
and MY_STACK_NAME
# The server clause sets the main parameters. | |
server: | |
# Allow network connections outside of localhost | |
interface: 0.0.0.0 | |
# Don't automatically run in the background because I want to be able to kill it without hunting a pid | |
do-daemonize: no | |
# TODO: Change this to your network range, like `192.168.0.0/16 allow` | |
access-control: 10.0.0.0/16 allow | |
# TODO: Change this to your username, or whatever user you want to run/own the `unbound` process | |
username: "bryanjswift" |
This is a story about how I tried to use Go for scripting. In this story, I’ll discuss the need for a Go script, how we would expect it to behave and the possible implementations; During the discussion I’ll deep dive to scripts, shells, and shebangs. Finally, we’ll discuss solutions that will make Go scripts work.
While python and bash are popular scripting languages, C, C++ and Java are not used for scripts at all, and some languages are somewhere in between.
# Iterates over files and subdirectories in directorie[s] given as arguments | |
# and adds raw text of those files to merged.txt in the working directory | |
# where the script is called | |
# Call like this: | |
# ruby merge.rb {absolute path portion to delete} {directory to scan} [{directory to scan}] | |
# For example: | |
# ruby merge.rb /Users/donnieclapp/Projects/ ~/Projects/htl-website/myproject/static_media/stylesheets | |
# create or open the merged.txt file for writing (in working directory) |