Save AMI Id to database.
Make sure IP address is assigned in tasks.launch().