Skip to content

Instantly share code, notes, and snippets.

View charlieoleary's full-sized avatar

Charlie O'Leary charlieoleary

View GitHub Profile
@charlieoleary
charlieoleary / ecr_auth.rb
Last active May 14, 2019 19:31
Login to AWS ECR with Chef + Docker Cookbook
#
# Cookbook:: utility
# Recipe:: ecr_auth
#
# depends 'docker', '~> 4.8.0'
#
# Required Attributes:
# default['aws']['ecr']['registry_id'] = AWS account ID for the registry.
# default['aws']['ecr']['region'] = AWS region for the registry.
#
@charlieoleary
charlieoleary / migrate-to-ecr.sh
Last active December 14, 2022 21:22
Migrate your Docker Hub organization to ECR.
#!/bin/bash
#
# A simple bash script to migrate your Docker Hub organization to ECR with pretty minimal effort.
# Adapted from kizbitz's original script -- https://gist.github.com/kizbitz/e59f95f7557b4bbb8bf2
#
# In order for this to work you must run this from a system that is logged in to both the ECR
# repository you are migrating TO and the Docker Hub organization you are migrating FROM.
#
# Due to how Docker works (pulling / pushing images), this script can be run over and over
# without any issues. Note that ECR authentication times out after 24 hours, so if you are
@charlieoleary
charlieoleary / getInstanceStorage.sh
Created February 23, 2021 23:16
Get EC2 Instance Storage Devices
cat /dev/null > ${HOME}/instance_storage_devices
for device in $(ls -1 /dev/nvme*n[0-1000]); do
MNT_TYPE=$(nvme id-ctrl -v $device | grep mn | grep -v mntmt | cut -d":" -f2);
[[ "${MNT_TYPE}" == *"NVMe Instance Storage"* ]] && echo -n " ${device}" >> ${HOME}/instance_storage_devices
done