This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# a quick script to export all instances from all regions to csv | |
import os | |
import boto3 | |
from botocore.exceptions import ClientError | |
from datetime import datetime, timedelta | |
import logging | |
import sys | |
import csv |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
""" | |
A quick script to get temporary aws access keys. | |
expects AWS_MFA_ARN to exist in the aws default credential | |
export AWS_MFA_ARN="arn:aws:iam::123456789:mfa/me" | |
""" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
function get_classic_elb_backend_counts(){ | |
region=${2:-us-west-2} | |
aws --profile $1 --region $region elb describe-load-balancers | \ | |
jq -r --arg profile "$1" --arg region "$region" '.LoadBalancerDescriptions[] | [$profile, $region, .LoadBalancerName, (.Instances|length)] | @csv' | |
} | |
function aws_regions(){ | |
aws ec2 describe-regions | jq -r '.Regions[].RegionName' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import csv | |
import os | |
import boto3 | |
from botocore.exceptions import ClientError | |
from datetime import datetime, timedelta | |
import logging | |
import sys | |
#import aws_pricing_api |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import json | |
import requests | |
url = 'https://pricing.us-east-1.amazonaws.com/offers/v1.0/aws/AmazonEC2/current/index.json' | |
resp = requests.get(url=url) | |
data = json.loads(resp.text) | |
hourlyTermCode = 'JRTCKXETXF' | |
rateCode = '6YS6EN2CT7' | |
products = data['products'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sh | |
from sh import terraform, Command | |
go_getter = Command("go-getter") | |
from sh import ErrorReturnCode | |
import yaml | |
import logging | |
import re | |
import os |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import gnupg | |
# from dotenv import dotenv_values | |
import sh | |
import shlex | |
import os | |
from pprint import pprint | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"command": "uptime -s", | |
"name": "uptime_since", | |
"result": [ | |
"2018-04-16 02:40:37" | |
] | |
}, | |
{ | |
"command": "hostname", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
apiVersion: v1 | |
kind: ServiceAccount | |
metadata: | |
name: jobseeder | |
--- | |
apiVersion: rbac.authorization.k8s.io/v1 | |
kind: Role | |
metadata: | |
name: jobseeder |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# export AWS_SERIAL_NUMBER=<your-mfa-arn> | |
declare -A iam_roles | |
iam_roles[dev]="arn:aws:iam::<account>:role/<assume-role-name>" | |
iam_roles[qa]="arn:aws:iam::<account>:role/<assume-role-name>" | |
function _aws_sts_get_session_token(){ | |
unset AWS_SESSION_TOKEN AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY | |
set -x |
OlderNewer