I am hitting an API using Curl command which create an EC2 instance in AWS and return the private IP of EC2 instance.
- newrigprivateip=$(curl -X POST -H "Content-Type:application/json" -d "'{AMI_ID:'ami-9xxxxxx'}'" $posturl)
- echo $newrigprivateip > $build
Now sometimes my private IP takes time to generate and because of that my script failed. Can we write the curl command in such a way that it will wait for the EC2 instance to up and wait until the private IP return.