Skip to content

Instantly share code, notes, and snippets.

terraform {
backend "gcs" {
bucket = "terraform-state-limed"
prefix = "terraform/gke"
}
}
locals {
project_id = "mozilla-it-service-engineering"
@limed
limed / data.tf
Created July 7, 2020 16:05
terraform for dev eks cluster
data "aws_vpc" "this" {
id = "vpc-09f6a265a28ff8c52"
}
data "aws_subnet_ids" "public" {
vpc_id = data.aws_vpc.this.id
filter {
name = "tag:Name"
values = ["*public*"]
@limed
limed / maws-federate.py
Last active June 4, 2022 22:31
Federate into aws console when you have aws keys exported
#!/usr/bin/env python3
import json
import sys
import requests
import click
from webbrowser import open_new_tab
from urllib.parse import quote_plus
from os import getenv, environ
#!/usr/bin/env python
import boto3
import os
try:
client = boto3.client('ec2')
except Execption as e:
print ("Unable to create ec2 client: {}".format(e))
os.exit(1)
@limed
limed / docker-compose.yml
Created November 5, 2019 20:51
TICK stack docker-compose setup for local tests
version: '3.4'
services:
influxdb:
image: influxdb:latest
volumes:
- ~/docker/volumes/tick/influx/data:/var/lib/influxdb
- ~/docker/volumes/tick/influx/config/:/etc/influxdb
environment:
INFLUXDB_REPORTING_DISABLED: "true"
@limed
limed / ri-parse.py
Created September 19, 2019 00:46
Parses info out of RI csv that cost explorer generates
#!/usr/bin/env python
import csv
from argparse import ArgumentParser
if __name__ == "__main__":
parser = ArgumentParser()
parser.add_argument("-f", "--file", dest="csv_file",
required=True, help="CVS File to parse")
parser.add_argument("-d", "--debug", dest="debug", action='store_true',
FROM alpine:3.9
ENV LIFECYCLED_VERSION="v3.0.2"
ENV KUBECTL_VERSION="v1.12.1"
ENV TERM=xterm
RUN apk add --no-cache bash curl && \
curl -Lf -o lifecycled https://github.com/buildkite/lifecycled/releases/download/v3.0.2/lifecycled-linux-amd64 && \
chmod +x lifecycled && \
curl -Lf -o /usr/bin/kubectl https://storage.googleapis.com/kubernetes-release/release/${KUBECTL_VERSION}/bin/linux/amd64/kubectl && \
@limed
limed / lifecycled.unit
Last active May 8, 2019 23:02
lifecycled handler
[Unit]
Description=Autoscale Lifecycle Daemon
Requires=network-online.target
After=network-online.target
[Service]
Type=simple
Restart=on-failure
RestartForceExitStatus=SIGPIPE
RestartSec=30s
@limed
limed / cloud-janitor.py
Last active April 5, 2019 17:40
Deregisters AMI, deletes snapshots and volumes based on years
#!/usr/bin/env python
import boto3
import os
try:
client = boto3.client('ec2')
except Execption as e:
print ("Unable to create ec2 client: {}".format(e))
os.exit(1)
@limed
limed / create-role-user
Last active February 15, 2019 02:03
creates an IAM role and allows a user to do a role assumption
#!/usr/bin/env bash
set -o errexit
set -o pipefail
USERNAME=$1
ACCOUNT_ID=$(aws sts get-caller-identity --query "Account" --output text)
errexit() {
echo "$1"