Skip to content

Instantly share code, notes, and snippets.

@cloudfiles-me
cloudfiles-me / lambda_edge_example.js
Last active February 7, 2019 14:55
Example of Lambda@edge function
'use strict';
exports.handler = (event, context, callback) => {
const request = event.Records[0].cf.request;
const headers = request.headers;
const origin = request.origin;
const hostname = event.Records[0].cf.request.headers['host'][0]['value'];
//Setup the two different origins
const originA = "spa-jorgehrn.s3-website-us-east-1.amazonaws.com";
@cloudfiles-me
cloudfiles-me / k8s-svc-annotations.md
Created December 18, 2018 23:22 — forked from mgoodness/k8s-svc-annotations.md
AWS ELB-related annotations for Kubernetes Services (as of v1.12.0)
  • service.beta.kubernetes.io/aws-load-balancer-access-log-emit-interval (in minutes)
  • service.beta.kubernetes.io/aws-load-balancer-access-log-enabled (true|false)
  • service.beta.kubernetes.io/aws-load-balancer-access-log-s3-bucket-name
  • service.beta.kubernetes.io/aws-load-balancer-access-log-s3-bucket-prefix
  • service.beta.kubernetes.io/aws-load-balancer-additional-resource-tags (comma-separated list of key=value)
  • service.beta.kubernetes.io/aws-load-balancer-backend-protocol (http|https|ssl|tcp)
  • service.beta.kubernetes.io/aws-load-balancer-connection-draining-enabled (true|false)
@cloudfiles-me
cloudfiles-me / curl.md
Created December 17, 2018 17:59 — forked from subfuzion/curl.md
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@cloudfiles-me
cloudfiles-me / readme.md
Created December 17, 2018 16:22 — forked from arun-gupta/readme.md
knative + kubernetes + aws

Knative on Kubernetes on AWS

Knative requires Kubernetes 1.10 and Istio 0.8.0 to be installed. It also requires default namespace injection for Istio to be enabled which rules out EKS as a deployment platform. One of Istio pods is failing and so it cannot be installed on a kops-based cluster as well. This is filed as knative/docs#359.

EKS

  • Install eksctl: brew install weaveworks/tap/eksctl
  • Create EKS cluster: eksctl create cluster --name myeks --nodes 4 --region us-west-2
@cloudfiles-me
cloudfiles-me / readme.adoc
Created December 17, 2018 16:22 — forked from arun-gupta/readme.adoc
Using Amazon CNI with kops-created Kubernetes cluster

AWS CNI plugin is now merged with kops: kubernetes/kops#3997. This gist explains how to build kops, create a Kubernetes cluster using correct --networking option, and then test it.

Build kops

export GOPATH=`pwd`
mkdir src/k8s.io; cd src/k8s.io
git clone git@github.com:kubernetes/kops.git
cd kops
export S3_BUCKET_NAME=<some bucket you own>
@cloudfiles-me
cloudfiles-me / readme.md
Created December 17, 2018 16:21 — forked from arun-gupta/readme.md
Getting Started with HPA on EKS
  • Create an EKS cluster: eksctl create cluster --name myeks --nodes 4 --region us-west-2
  • Install Metrics Server
    kubectl apply -f https://raw.githubusercontent.com/kubernetes-incubator/metrics-server/master/deploy/1.8%2B/auth-delegator.yaml
    kubectl apply -f https://raw.githubusercontent.com/kubernetes-incubator/metrics-server/master/deploy/1.8%2B/auth-reader.yaml
    kubectl apply -f https://raw.githubusercontent.com/kubernetes-incubator/metrics-server/master/deploy/1.8%2B/metrics-apiservice.yaml
    kubectl apply -f https://raw.githubusercontent.com/kubernetes-incubator/metrics-server/master/deploy/1.8%2B/metrics-server-deployment.yaml
    kubectl apply -f https://raw.githubusercontent.com/kubernetes-incubator/metrics-server/master/deploy/1.8%2B/metrics-server-service.yaml
    kubectl apply -f https://raw.githubusercontent.com/kubernetes-incubator/metrics-server/master/deploy/1.8%2B/resource-reader.yaml
    
@cloudfiles-me
cloudfiles-me / readme.adoc
Created December 17, 2018 16:21 — forked from arun-gupta/readme.adoc
Federated Kubernetes Cluster using Kops on AWS

Let’s set up a federation between earth and mars Kubernetes cluster on AWS.

Earth cluster

  1. Create hosted zone:

    ID=$(uuidgen) && \
       aws route53 create-hosted-zone \
       --name earth.kubernetes-aws.io \
@cloudfiles-me
cloudfiles-me / all_aws_lambda_modules.txt
Created November 15, 2018 16:57 — forked from gene1wood/all_aws_lambda_modules_python.md
AWS Lambda function to list all available Python modules and post the list to Pastebin
# module list (generated by listmodules.py)
#
# timestamp='20160226T200954Z'
# sys.version='2.7.10 (default, Dec 8 2015, 18:25:23) \n[GCC 4.8.3 20140911 (Red Hat 4.8.3-9)]'
# sys.platform='linux2'
# platform='Linux-4.1.13-19.31.amzn1.x86_64-x86_64-with-glibc2.2.5'
#
BaseHTTPServer
Bastion
CDROM
@cloudfiles-me
cloudfiles-me / cloud9_runner_python_virtualenv.md
Created October 24, 2018 15:47
Cloud9 Runner for python virtualenv
  • Snippet for creating a Cloud9 Runner which use python virtualenv
// This file overrides the built-in Python VirtualEnv runner
// For more information see http://docs.aws.amazon.com/console/cloud9/change-runner
{
  "cmd": [
    "bash",
    "--login",
 "-c",
@cloudfiles-me
cloudfiles-me / rds_iam_auth_example.md
Created October 23, 2018 16:35
Example of RDS IAM auth
  • Create a IAM Policy and attach it to a user or role
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "rds-db:connect"
            ],