Skip to content

Instantly share code, notes, and snippets.

@andymac4182
Created June 3, 2018 02:45
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 andymac4182/30931788acbb1fbf3f7762a4a8e632a9 to your computer and use it in GitHub Desktop.
Save andymac4182/30931788acbb1fbf3f7762a4a8e632a9 to your computer and use it in GitHub Desktop.
describe-target-health() {
aws elbv2 describe-target-health --target-group-arn $1 --targets Id=$2
}
targetGroup=$( get_octopusvariable "AWSELBv2ARN" )
if [ -z "$targetGroup" ];
then
echo Target Group is missing
exit 1
fi
instanceId=$(curl -s http://169.254.169.254/latest/meta-data/instance-id)
if [ -z "$instanceId" ];
then
echo InstanceId is missing
exit 1
fi
export AWS_ACCESS_KEY_ID=$(get_octopusvariable "InfrastructureAWSAccessKey")
export AWS_SECRET_ACCESS_KEY=$(get_octopusvariable "InfrastructureAWSSecretKey")
export AWS_DEFAULT_REGION=$(get_octopusvariable "InfrastructureAWSRegion")
export AWS_DEFAULT_OUTPUT=table
describe-target-health $targetGroup $instanceId
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment