Skip to content

Instantly share code, notes, and snippets.

View otterley's full-sized avatar

Michael S. Fischer otterley

  • Amazon Web Services
  • Seattle, WA
View GitHub Profile
@otterley
otterley / handler.py
Created June 17, 2020 04:36
Lambda function for propagating EKS managed nodegroup tags
#!/usr/bin/env python
import boto3
import botocore.exceptions
import logging
from time import sleep
MAX_ATTEMPTS = 100
def handler(event, context):
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
namespace: default
name: pod-reader
rules:
- apiGroups: [""] # "" indicates the core API group
resources: ["pods"]
verbs: ["get", "watch", "list"]
apiVersion: rbac.authorization.k8s.io/v1
# This role binding allows "jane" to read pods in the "default" namespace.
# You need to already have a Role named "pod-reader" in that namespace.
kind: RoleBinding
metadata:
name: read-pods
namespace: default
subjects:
# You can specify more than one "subject"
- kind: User
@otterley
otterley / amazon-eks-nodegroup.template.yaml
Created March 31, 2020 00:55
Amazon EKS (Unmanaged) Nodegroup CloudFormation Template
AWSTemplateFormatVersion: "2010-09-09"
Description: Amazon EKS - Node Group
Mappings:
ServicePrincipals:
aws-cn:
ec2: ec2.amazonaws.com.cn
aws:
ec2: ec2.amazonaws.com
@otterley
otterley / amazon-eks-controlplane.template.yaml
Created March 31, 2020 00:53
Minimal EKS cluster CloudFormation template
AWSTemplateFormatVersion: "2010-09-09"
Description: "Deploys the EKS control plane"
Parameters:
VPCID:
Description: ID of your existing VPC for deployment
Type: AWS::EC2::VPC::Id
SubnetIds:
Type: List<AWS::EC2::Subnet::Id>
KubernetesVersion:
Type: String
@otterley
otterley / vpc-endpoint-policy.json
Created July 7, 2019 16:23
Example S3-granting VPC endpoint policy
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": "*",
"Action": [
"s3:GetObject",
"s3:GetObjectVersion",
"s3:ListBucket"
@otterley
otterley / policy.json
Created July 7, 2019 16:22
Example S3 instance role policy
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:GetObject",
"s3:GetObjectVersion",
"s3:ListBucket"
],
@otterley
otterley / main.go
Created March 2, 2017 04:52
s3gof3r example
package main
import (
"compress/gzip"
"io"
"log"
"net/http"
"os"
"github.com/rlmcpherson/s3gof3r"

Keybase proof

I hereby claim:

  • I am otterley on github.
  • I am otterley (https://keybase.io/otterley) on keybase.
  • I have a public key whose fingerprint is A02C D15E C624 0B33 5C88 43EE 01F7 123D FA61 646D

To claim this, I am signing this object:

attrs_json = cookbook_file "/tmp/attrs.json" do
action :nothing
source "examples/attributes.json"
mode 00600
end
attrs_json.run_action(:create)
attrs = JSON.load(File.open("/tmp/attrs.json"))
node.consume_attributes(attrs)