Added support for providing public key in instance creation.