Skip to content

Instantly share code, notes, and snippets.

@kjenney
kjenney / gist:c4537596c0eb3ca0d88419405d3cf40a
Last active June 5, 2016 21:29
EC2 Create Instance and Resize Filesystem
#!/bin/bash
# Tester script to create an EC2 instance and resize the filesystem
function resizeit {
echo "--------------------- RESIZING ---------------------"
echo
echo -e "\tPowering down the instance - $awsinstanceid"
ec2-stop-instances $awsinstanceid > /dev/null 2>&1
aws ec2 wait instance-stopped --instance-id $awsinstanceid
security find-generic-password -D "AirPort network password" -a MySSID -g
@kjenney
kjenney / eks.yml
Created July 18, 2018 20:13
CloudFormation EKS
# kubernetes
#
#
# author: kjenney
# Deploys an EKS cluster with required role and security group
AWSTemplateFormatVersion: 2010-09-09
Description: Deploys an EKS cluster with required role and security group
Parameters:
@kjenney
kjenney / rbac.yml
Created July 18, 2018 20:23
Kubernetes EKS RBAC
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
name: ingress-nginx
namespace: ingress-nginx
rules:
- apiGroups:
- ""
resources:
- services
@kjenney
kjenney / coffee.yml
Created July 18, 2018 20:28
EKS Test service and deploy
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: coffee
namespace: ingress-nginx
spec:
replicas: 2
selector:
matchLabels:
app: coffee
@kjenney
kjenney / coffee-ingress.yml
Last active September 2, 2018 18:46
EKS Test Ingress
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: coffee
namespace: ingress-nginx
spec:
tls:
- hosts:
- cafe.example.com
secretName: cafe-secret
var nock = require('nock')
var http = require('http');
var request = require('request-promise');
nock('http://greetings_api:3000')
.post('/getGreeting')
.matchHeader('content-type', 'application/json')
.matchHeader('language', 'es')
.matchHeader('host', 'greetings_api:3000')
.matchHeader('content-length', 0)
@kjenney
kjenney / handler.py
Created November 21, 2018 02:18
Boto3 Upload Failure
import os
import io
import json
import boto3
from boto3.exceptions import ResourceNotExistsError
from botocore.exceptions import ClientError
import pprint
import logging
import tempfile
from wand.image import Image
@kjenney
kjenney / bootstrap.py
Created September 5, 2021 16:42
Python Boto3 Create and Delete Resources
import argparse
from botocore.exceptions import ClientError
import boto3
from cryptography.fernet import Fernet
import json
import logging
from pprint import pprint
import uuid
'''
Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
+ create
Terraform will perform the following actions:
# aws_s3_bucket.b will be created
+ resource "aws_s3_bucket" "b" {
+ acceleration_status = (known after apply)
+ acl = (known after apply)
+ arn = (known after apply)