Files
linuxkit/alpine/cloud/aws/common.sh
Nathan LeClaire 5bdb60c30f Add modifications to help with downstream build
Signed-off-by: Nathan LeClaire <nathan.leclaire@gmail.com>
2016-08-17 18:23:01 -07:00

35 lines
875 B
Bash

#!/bin/sh
set -e
TAG_KEY=${TAG_KEY:-editionsdev}
TAG_KEY_PREV=${TAG_KEY_PREV:-editionsdev}
INSTANCE_ENDPOINT="http://169.254.169.254/latest"
INSTANCE_METADATA_API_ENDPOINT="${INSTANCE_ENDPOINT}/meta-data/"
IMAGE_NAME=${IMAGE_NAME:-"Moby Linux ${TAG_KEY}"}
IMAGE_DESCRIPTION=${IMAGE_DESCRIPTION:-"The best OS for running Docker, version ${TAG_KEY}"}
current_instance_region()
{
curl -s "${INSTANCE_ENDPOINT}/dynamic/instance-identity/document" | jq .region -r
}
current_instance_az()
{
curl -s "${INSTANCE_METADATA_API_ENDPOINT}/placement/availability-zone"
}
current_instance_id()
{
curl -s "${INSTANCE_METADATA_API_ENDPOINT}/instance-id"
}
# We tag resources created as part of the build to ensure that they can be
# cleaned up later.
tag()
{
arrowecho "Tagging $1"
aws ec2 create-tags --resources "$1" --tags "Key=${TAG_KEY},Value=" >/dev/null
}