forked from mpemer/puppet.bin
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcapture-ec2-meta-data.sh
More file actions
executable file
·28 lines (27 loc) · 1.22 KB
/
capture-ec2-meta-data.sh
File metadata and controls
executable file
·28 lines (27 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/bash
BASE_URL="http://169.254.169.254/latest/meta-data"
instance_id=$(curl -s $BASE_URL/instance-id)
host_name="$(hostname -s)"
if [ "x${1}" == "xsingleton" ]
then
DEST="/etc/puppet/state/${FACTER_iteego_environment}/${host_name}/meta-data"
else
DEST="/etc/puppet/state/${FACTER_iteego_environment}/${host_name}/${instance_id}/meta-data"
fi
[ -d "${DEST}" ] || mkdir -p "${DEST}"
echo "${instance_id}" >"${DEST}/instance-id"
curl -s $BASE_URL/ami-id >"${DEST}/ami-id"
curl -s $BASE_URL/ami-launch-index >"${DEST}/ami-launch-index"
curl -s $BASE_URL/ami-manifest-path >"${DEST}/ami-manifest-path"
curl -s $BASE_URL/hostname >"${DEST}/hostname"
curl -s $BASE_URL/instance-action >"${DEST}/instance-action"
curl -s $BASE_URL/instance-type >"${DEST}/instance-type"
curl -s $BASE_URL/kernel-id >"${DEST}/kernel-id"
curl -s $BASE_URL/local-hostname >"${DEST}/local-hostname"
curl -s $BASE_URL/local-ipv4 >"${DEST}/local-ipv4"
curl -s $BASE_URL/mac >"${DEST}/mac"
curl -s $BASE_URL/profile >"${DEST}/profile"
curl -s $BASE_URL/public-hostname >"${DEST}/public-hostname"
curl -s $BASE_URL/public-ipv4 >"${DEST}/public-ipv4"
curl -s $BASE_URL/reservation-id >"${DEST}/reservation-id"
curl -s $BASE_URL/security-groups >"${DEST}/security-groups"