Contents
Operation
Query
- describe user environment:
euca-describe-keypairs
- describe static cloud environment:
euca-describe-availability-zones euca-describe-groups euca-describe-images
- describe running environment:
euca-describe-instances euca-describe-addresses euca-describe-volumes euca-describe-snapshots
Insatnces
- create:
euca-run-instances -k "${_euca_default_key:-?}" -t "${_euca_default_type:-?}" -z "${_euca_default_zone:-?}" --addressing private "${_euca_default_image:-?}" _euca_current_instance=...
- termination:
euca-terminate-instances "${_euca_current_instance:-?}"
- connecting:
ssh root@"${_euca_current_address:-?}" -i "${_euca_default_key_path:-?}" -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no
- defaults:
_euca_default_zone=... _euca_default_image=... _euca_default_type=m1.small _euca_default_key=default _euca_default_key_path=~/.ssh/default@eucalyptus.key
Volumes
- creation:
euca-create-volume -s "${__size:-1}" -z "${_euca_default_zone:-?}" _euca_current_volume=...
- attachment:
euca-attach-volume -i "${_euca_current_instance:-?}" -d "${__device:-/dev/sdb}" "${_euca_current_volume:-?}"
- detachment:
euca-detach-volume "${_euca_current_volume:-?}"
- destruction:
euca-delete-volume "${_euca_current_volume:-?}"
Addresses
- allocation:
euca-allocate-address _euca_current_address=...
- association:
euca-associate-address -i "${_euca_current_instance:-?}" "${_euca_current_address:-?}"
- disassociation:
euca-disassociate-address "${_euca_current_address:-?}"
- deallocation:
euca-release-address "${_euca_current_address:-?}"
Groups
- authorize SSH:
euca-authorize -P tcp -p 22 -s 0.0.0.0/0 default
Keypairs
- create:
euca-add-keypair default >~/.ssh/default@eucalyptus.key chmod 0400 ~/.ssh/default@eucalyptus.key
Links
Eucalyptus
Amazon
Tools
EC2 data fetcher
(
set -e -E -C -u -o pipefail || exit 1
exec {_lock}>|/tmp/ec2-data.lock
flock -xn "${_lock}"
test ! -e /tmp/ec2-data
test ! -e /tmp/ec2-data.tar.gz
mkdir /tmp/ec2-data
echo -n >/tmp/ec2-data/.index
echo -n >/tmp/ec2-data/.index.enqueue
mkdir /tmp/ec2-data/2009-04-04
echo '2009-04-04/user-data' >>/tmp/ec2-data/.index.enqueue
echo '2009-04-04/meta-data/' >>/tmp/ec2-data/.index.enqueue
while test -s /tmp/ec2-data/.index.enqueue
do
mv -T /tmp/ec2-data/.index.enqueue /tmp/ec2-data/.index.dequeue
echo -n >/tmp/ec2-data/.index.enqueue
while read _target
do
echo "[ii] fetching \`${_target}\`..." >&2
curl -s "http://169.254.169.254/${_target}" >"/tmp/ec2-data/${_target%%/}.tmp"
case "${_target}" in
( */ )
test ! -e "/tmp/ec2-data/${_target%%/}"
mkdir "/tmp/ec2-data/${_target%%/}"
{ cat "/tmp/ec2-data/${_target%%/}.tmp" ; echo ; } \
| while read _entry
do
test -n "${_entry}" || break
echo "${_target}${_entry}" >>/tmp/ec2-data/.index.enqueue
done
mv "/tmp/ec2-data/${_target%%/}.tmp" "/tmp/ec2-data/${_target%%/}/.data"
;;
( * )
test ! -e "/tmp/ec2-data/${_target}"
mv -T "/tmp/ec2-data/${_target}.tmp" "/tmp/ec2-data/${_target}"
;;
esac
echo "${_target}" >>/tmp/ec2-data/.index
done </tmp/ec2-data/.index.dequeue
done
rm /tmp/ec2-data/.index.enqueue
rm /tmp/ec2-data/.index.dequeue
tar -czf /tmp/ec2-data.tar.gz -C /tmp ./ec2-data
echo "[ii] succeeded" >&2
)EC2 data service
( set -e -E -C -u -o pipefail || exit 1 exec sudo webfsd -F -i 169.254.169.254 -p 80 -R /tmp/ec2-data -f .data )
Setup
Eucalyptus tools
- Python virtual environment deployment:
( set -x -e -E -C -u -o pipefail || exit 1 _version=2.7 exec {_lock}>|/tmp/eucalyptus-tools.lock flock -xn "${_lock}" test ! -e /tmp/eucalyptus-tools virtualenv --python="python${_version}" --no-site-packages /tmp/eucalyptus-tools )
- euca2ools deployment:
( set -x -e -E -C -u -o pipefail || exit 1 _version=3.0.2 exec {_lock}>|/tmp/eucalyptus-tools.lock flock -xn "${_lock}" test -e /tmp/eucalyptus-tools test -e "/tmp/euca2ools-${_version}.tar.gz" || \ wget -O "/tmp/euca2ools-${_version}.tar.gz" "https://github.com/eucalyptus/euca2ools/archive/${_version}.tar.gz" mkdir /tmp/euca2ools--build tar -xzf "/tmp/euca2ools-${_version}.tar.gz" -C /tmp/euca2ools--build cd "/tmp/euca2ools--build/euca2ools-${_version}" /tmp/eucalyptus-tools/bin/python ./setup.py install cd /tmp rm -Rf /tmp/euca2ools--build )
- euca2ools bundle:
( set -x -e -E -C -u -o pipefail || exit 1 exec {_lock}>|/tmp/eucalyptus-tools.lock flock -xn "${_lock}" find /tmp/eucalyptus-tools -type d -exec chmod 0555 {} \; find /tmp/eucalyptus-tools -type f -executable -exec chmod 0555 {} \; find /tmp/eucalyptus-tools -type f -not -executable -exec chmod 0444 {} \; tar -czf /tmp/eucalyptus-tools.tar.gz -C /tmp ./eucalyptus-tools )
