Skip to content

Instantly share code, notes, and snippets.

View jeffbrl's full-sized avatar

Jeff Loughridge jeffbrl

View GitHub Profile
@jeffbrl
jeffbrl / server.py
Created April 12, 2024 20:15
Simple python webserver with HTTP header printing
import sys
from http.server import SimpleHTTPRequestHandler, HTTPServer
DEFAULT_PORT=8080
class RequestHandler(SimpleHTTPRequestHandler):
def do_GET(self):
print(self.headers)
SimpleHTTPRequestHandler.do_GET(self)
@jeffbrl
jeffbrl / docker_cloud_init.sh
Last active March 10, 2024 16:28
Cloud-init for Debian Docker Host
#cloud-config
# Adapted from Mathew Dugan's article at https://matduggan.com/idiot-proof-infrastructure/
package_update: true
package_upgrade: true
package_reboot_if_required: true
groups:
- docker
@jeffbrl
jeffbrl / user-data.sh
Created March 22, 2023 13:13
User-data for Amazon Linux 2 Apache with Self-Signed Cert
#!/bin/bash -xe
# Use with Amazon Linux 2
# Amazon Linux 2023 doesn't seem to have make-dummy-cert script
yum update -y
yum install -y httpd mod_ssl
systemctl start httpd
systemctl enable httpd
usermod -a -G apache ec2-user
chown -R ec2-user:apache /var/www
@jeffbrl
jeffbrl / interregion.md
Last active March 4, 2023 16:04
Technical Article Generated by ChatGPT

AWS Inter-Region Architectures

Cloud architects looking to leverage the cloud for their inter-region architectures can benefit from utilizing the services provided by Amazon Web Services (AWS). This blog will cover the basics of networking, VPC, Cloud WAN, Transit Gateway, and VPC peering and explain how they can be used to successfully set up an inter-region architecture.

Introduction to AWS Inter-Region Architectures

Using AWS for inter-region architectures can provide many benefits such as lower costs, improved scalability, and increased availability and reliability. To understand how to make use of these benefits, it is important to have a basic understanding of networking components and concepts. The main component of a network is the Virtual Private Cloud (VPC) which provides a secure and isolated environment within the cloud where resources can be hosted. A VPC consists of subnets, route tables, network gateways, security groups, and other elements that are used to set up and manage a network.

@jeffbrl
jeffbrl / user-data.sh
Created September 28, 2021 19:42
User data for Ubuntu 20.04 Apache2 Basic HTTP Example
#!/bin/bash -xe
apt-get -y update
apt-get install -y apache2
echo `hostname` > /var/www/html/index.html
echo '<br><br>' >> /var/www/html/index.html
# create ~ 12K of random text
base64 /dev/urandom | head -c 10000 >> /var/www/html/index.html
@jeffbrl
jeffbrl / terraform_s3_backend.tf
Created December 22, 2020 16:49
Terraform template to create S3 backend with DynamoDB lock
# Adapted from tips at https://blog.gruntwork.io/how-to-manage-terraform-state-28f5697e68fa
provider "aws" {
region = "us-east-1"
}
resource "aws_s3_bucket" "terraform_state" {
bucket = "uniqueBuckeName"
# Enable versioning so we can see the full revision history of our
# state files
@jeffbrl
jeffbrl / keybase.md
Created November 1, 2020 14:24
keybase.md

Keybase proof

I hereby claim:

  • I am jeffbrl on github.
  • I am jbl2 (https://keybase.io/jbl2) on keybase.
  • I have a public key ASDzY1kXVhRrICyL8LKOAHX_wAHqxYWVL3MzY0_OiDZ24go

To claim this, I am signing this object:

@jeffbrl
jeffbrl / linux-gui.yml
Last active September 18, 2022 19:14
Linux Bastion with GUI - CloudFormation template
AWSTemplateFormatVersion: 2010-09-09
Description: >-
AWS CloudFormation template to create a linux bastion host with a GUI that can
be accessed via x2go.
Parameters:
KeyName:
Description: Name of an existing EC2 KeyPair to enable SSH access to the instances
Type: String
VPC:
@jeffbrl
jeffbrl / vpc-ingress-routing.yaml
Created April 7, 2020 21:37
VPC Ingress Routing CloudFormation
AWSTemplateFormatVersion: 2010-09-09
Description: >-
AWS CloudFormation template to deploy a VPC with VPC Ingress Routing
Parameters:
KeyName:
Description: Name of an existing EC2 KeyPair to enable SSH access to the instances
Type: String
AmazonLinuxAMI:
Type: "AWS::SSM::Parameter::Value<AWS::EC2::Image::Id>"
Default: "/aws/service/ami-amazon-linux-latest/amzn2-ami-hvm-x86_64-gp2"
@jeffbrl
jeffbrl / lambda_internet.py
Created April 7, 2020 00:32
Lambda function to check for Internet access
import logging
import os
import socket
logger = logging.getLogger()
logger.setLevel(logging.INFO)
# use static IP of public DNS (e.g., 8.8.8.8)
IP = os.environ['ip']