Skip to content

Instantly share code, notes, and snippets.

@n0ts
Created September 24, 2013 04:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save n0ts/6680386 to your computer and use it in GitHub Desktop.
Save n0ts/6680386 to your computer and use it in GitHub Desktop.
/etc/profile.d/aws.sh
#!/bin/sh
if [ -x "`which aws 2> /dev/null`" ]; then
AZ=`curl --connect-timeout 3 -s http://169.254.169.254/latest/meta-data/placement/availability-zone`
if [ -n "$AZ" ]; then
export AWS_DEFAULT_REGION=`echo $AZ | cut -c 1-$((${#AZ} - 1))`
fi
complete -C aws_completer aws
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment