Your Analogy is bad… and you should feel bad!

A bad analogy can frame an entire conversation improperly. This is one of those “anecdotes from a middle-aged man posts.” So take it with a grain of salt.

A number of years ago I worked in the risk management team for an insurance company that sold long term care (LTC) insurance. LTC insurance is a private product that covers home health care and nursing home care if the policyholder is unable to take care of themselves on their own. I got to be friends with the new product design team as well as some folks in sales. So I asked them to explain how they sold our LTC insurance products.

Interestingly enough, the sales guys would frame the sales pitch as choosing between a Chevrolet and a Cadillac. The Chevy product was the base insurance policy without a lot of features. Just a simple product that pays up to $X dollars per day after you exhaust a deductible of $Y dollars. And it has a maximum payout of $Z. The Caddie product, on the other hand had all sorts of features like a much lower deductible, many more complicated policy choices and, most importantly, always cost more than the Chevy. If I recall, the main reason the Caddie product cost more was because the deductible options were pretty low.

If I had two put options which were exactly the same except one had a strike very close to the current market price and the other had a strike two standard deviations below the market price, it would be insane to call one a Chevy and the other a Caddie. They are just priced differently because they have a different probability of ending in the money.

10 Comments

  1. ken says:

    have the instance open a port (eg a via netcat or a webport) and try connecting in a loop, or just ssh with a command instead of interactive and check the status in a loop.

  2. Matt Pettis says:

    Very nice! I will be stealing this…

  3. Matt Pettis says:

    Very nice! I will be stealing (and, may have posted this already, browser hung on submit…)

  4. If you can modify the AMP as well, then you can something simple such as having /etc/rc.local have a command ‘date > /var/www/DoneBooting.txt’. Your shell script could then loop, test for said file via wget or curl, sleep for a second or two and try again. Or you leet the AMI instance tweet to a s3cr33t account and monitor that. Just kidding….

  5. Paul says:

    http://docs.amazonwebservices.com/AWSEC2/latest/CommandLineReference/ApiReference-cmd-DescribeInstances.html

    There is a status attribute you can check, this still means polling the instance with ec2-describe-instances.

    As suggested, you could run a script after the instance starts which actually ping you instead.
    Many people launch a skeleton instance and use that “after start” functionality to load software, scripts and data. If you combine with a provisioning tool such as puppet/chef, you have the instance ask the puppet/chef master what it needs to install.

  6. John Dennison says:

    Brilliant i have been struggling of how to capture the newly created instance id so i could pass it to my sftp/ssh. this is exactly that. one tweak to the ssh command. I’m running on fedora and my key as set to the standard system variable. I had to change the order of the RSA command else the ssh would fail. ie it needed to add the key my list of trusted servers. if i used:

    ssh -o StrictHostKeyChecking=no ubuntu@$name

    it works!!

  7. Siah says:

    Nice post.

    Can you ping your instance? do they get some sort of sub domain name or IP? if yes you can then ping it with regular ping and continue as soon as it responds.

  8. Mike says:

    Have you checked out StarCluster, out of MIT? That sounds like it might already do almost all of what you’re looking to do….

    http://web.mit.edu/stardev/cluster/

  9. John Dennison says:

    I have been working to automate the creation of ec2 for automated data runs. I have stolen your script and added some redundancies. I was having alot of problems with the EC2 machine denying my initial ssh requests so i built in if statement to retry. I am using a keypair already on the AMI. so no need for amazon key.

    instance_id=$(ec2-run-instances -g $secGroup -t t1.micro $ami | awk ‘/INSTANCE/{print $2}’)
    echo $instance_id

    name=$(ec2-describe-instances $instance_id | awk ‘/INSTANCE/{print $4}’)
    while [ $name = pending ] ; do
    sleep 5
    name=$(ec2-describe-instances $instance_id | awk ‘/INSTANCE/{print $4}’)
    echo $name
    done
    sleep 10
    OUT=0
    OUT1=0

    ssh -t -t -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no jdennison@$name< exit
    EOF
    OUT=$?
    if [ $OUT -ne 0 ];
    then
    echo “failed”
    sleep 15
    ssh -t -t -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no jdennison@$name< exit
    EOF1
    OUT1=$?
    fi

    if [ $OUT1 -ne 0 ];
    then
    echo “SECOND FAIL”
    sleep 10
    fi

  10. John Dennison says:

    The EOF1 redirects got deleted in the copy. they should look like

    ssh -t -t -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no jdennison@$name<<EOF1
    exit
    EOF1

Leave a Reply