Skip to content

Instantly share code, notes, and snippets.

@rickalm
rickalm / make_ephemeral.sh
Last active April 15, 2016 17:36
Transform the /dev/xvd[b-z] devices on AWS to /dev/ephemeral[0-9]
#!/bin/bash
#
# this script will attempt to detect any ephemeral drives and create /dev/ephemeral[0-9] device names
#
# Beware, This script is NOT fully idempotent.
#
METADATA_URL_BASE="http://169.254.169.254/2012-01-12"
# figure out the nameing convention
git name-rev --tags --name-only $(git rev-parse HEAD)
@rickalm
rickalm / expose_ecs_public_ports.sh
Last active December 6, 2018 17:43
How to discover Docker Public ports with AWS ECS
# When wanting to search for port 7000 (example) you would query the ECS agent endpoint searching for your docker
# container by its ID ($HOSTNAME). You can then parse the resulting json yourself, or use JQ to find the HostPort
# curl -sS http://172.17.0.1:51678/v1/tasks?dockerid=$HOSTNAME \
# | jq '.Containers[].Ports[] | select (.ContainerPort == 7000) | .HostPort'
# The following will create env vars identifying the public port numbers for mapped private ports
# (example assuming docker is exposing 80,443 and 8080)
#
# PUBLIC_PORT_80=32777
Parameters:
CfnDebug:
Description: Enable Debug Mode
Type: String
AllowedValues: [ "true", "false" ]
Default: "true"
Conditions:
isFalse: !Equals [ 'true', 'false' ]
isDebug: !Equals [ 'true', !Ref CfnDebug ]
==== {section}/{label}
{description} +
Required: {required} +