I am using a custom bash script to spin up/down EC2 instances as needed. The script creates the instance similar to: knife ec2 server create --config .chef/knife.rb with a few other parameters. It creates the instance fine but I want to be able to assign my elastic ip to the current active instance.

Short of sending the output to a text file, parsing the output for the IP and instance name, and then running ec2-associate-address -i $instancename $ipaddress is there a good way to do this programmatically?