created function to retrieve last snapshoted ami id for a given instance