Skip to content

Instantly share code, notes, and snippets.

View alanwill's full-sized avatar
🤔
Thinking

Alan Williams alanwill

🤔
Thinking
View GitHub Profile
@alanwill
alanwill / s3-bucket-move
Created December 5, 2015 20:27
Move an S3 bucket to a different region
aws s3 sync s3://oldbucket s3://newbucket --source-region us-west-1 --region us-west-2
@alanwill
alanwill / s3-bucket-size
Created December 5, 2015 20:26
Count the size of an S3 bucket
aws s3api list-objects --bucket BUCKETNAME --output json --query "[sum(Contents[].Size), length(Contents[])]"
@alanwill
alanwill / gist:c2f7ed88e765e530f24b
Created October 14, 2015 04:51 — forked from saetia/gist:1623487
Clean Install – OS X 10.11 El Capitan

OS X Preferences


most of these require logout/restart to take effect

# Enable character repeat on keydown
defaults write -g ApplePressAndHoldEnabled -bool false

# Set a shorter Delay until key repeat
#!/usr/bin/env ruby
require 'aws-sdk'
if ARGV.length < 5
print <<-EOF
Usage: mfa-delete.rb <bucket_name> <aws_id> <aws_secret> <mfa_serial> <mfa_token> <s3_endpoint>
<s3_endpoint> is optional
EOF
exit
end
@alanwill
alanwill / configure-pat.sh
Created July 27, 2014 04:12
Script used in AWS EC2 to enable an instance to perform port address translation (PAT). Found in /usr/local/sbin/configure-pat.sh
#!/bin/bash
# Configure the instance to run as a Port Address Translator (PAT) to provide
# Internet connectivity to private instances.
function log { logger -t "vpc" -- $1; }
function die {
[ -n "$1" ] && log "$1"
log "Configuration of PAT failed!"
exit 1
@alanwill
alanwill / keybase.md
Created July 14, 2014 20:54
Keybase verification

Keybase proof

I hereby claim:

  • I am alanwill on github.
  • I am alanwill (https://keybase.io/alanwill) on keybase.
  • I have a public key whose fingerprint is A6F6 A7F1 BDBA 605E A959 031B 8F58 1915 04B3 2B33

To claim this, I am signing this object:

@alanwill
alanwill / aws-cloudtrail-bucket-policy.json
Created July 6, 2014 08:51
S3 bucket policy for Cloudtrail logs to receive from multiple accounts
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AWSCloudTrailAclCheck20131101",
"Effect": "Allow",
"Principal": {
"AWS": [
"arn:aws:iam::903692715234:root",
"arn:aws:iam::859597730677:root",
@alanwill
alanwill / aws-cloudtrail-sqs-policy.json
Created July 6, 2014 08:48
Cloudtrail policy for SQS queue to receive messages from various SNS topics in multiple accounts
{
"Version": "2008-10-17",
"Id": "arn:aws:sqs:us-east-1:<core-account-number>:cloudtrail-notifications/SQSDefaultPolicy",
"Statement": [
{
"Sid": "Sid1385789515788",
"Effect": "Allow",
"Principal": {
"AWS": "*"
},
@alanwill
alanwill / aws-iam-s3-bucket-policy-ip-limit.json
Last active August 29, 2015 14:02
S3 bucket policy allowing access from a given IP or network
{
"Version": "2012-10-17",
"Id": "S3PolicyId1",
"Statement": [
{
"Sid": "IPAllow",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:*",
"Resource": "arn:aws:s3:::<S3-bucket-name>/*",
@alanwill
alanwill / cloudability-app-iam-user.json
Created March 8, 2014 04:51
Cloudability Application IAM User used to access account data
{
"Statement": [
{
"Effect": "Allow",
"Action": [
"aws-portal:ViewBilling",
"ec2:DescribeInstances",
"ec2:DescribeReservedInstances",
"cloudwatch:GetMetricStatistics"
],