Chapter 6. User Interface
32
For more information on creating a new instance, see Section 11.4, “Creating VMs”.
2. Download the script file cloud-set-guest-sshkey from the following link:
http://download.cloud.com/templates/4.2/bindir/cloud-set-guest-sshkey.in
3. Copy the file to /etc/init.d.
4. Give the necessary permissions on the script:
chmod +x /etc/init.d/cloud-set-guest-sshkey
5. Run the script while starting up the operating system:
chkconfig --add cloud-set-guest-sshkey
6. Stop the instance.
6.3.2. Creating the SSH Keypair
You must make a call to the createSSHKeyPair api method. You can either use the CloudPlatform
python api library or the curl commands to make the call to the CloudPlatform api.
For example, make a call from the CloudPlatform server to create a SSH keypair called "keypair-doc"
for the admin account in the root domain:
Note
Ensure that you adjust these values to meet your needs. If you are making the API call from a
different server, your URL or port number will be different, and you will need to use the API keys.
1. Run the following curl command:
curl --globoff "http://localhost:8080/?command=createSSHKeyPair&name=keypair-
doc&account=admin&domainid=1"
The output is something similar to what is given below:
<?xml version="1.0" encoding="ISO-8859-1"?><createsshkeypairresponse
cloud-stack-version="3.0.0.20120228045507"><keypair><name>keypair-
doc</name><fingerprint>f6:77:39:d5:5e:77:02:22:6a:d8:7f:ce:ab:cd:b3:56</
fingerprint><privatekey>-----BEGIN RSA PRIVATE KEY-----
MIICXQIBAAKBgQCSydmnQ67jP6lNoXdX3noZjQdrMAWNQZ7y5SrEu4wDxplvhYci
dXYBeZVwakDVsU2MLGl/K+wefwefwefwefwefJyKJaogMKn7BperPD6n1wIDAQAB
AoGAdXaJ7uyZKeRDoy6wA0UmF0kSPbMZCR+UTIHNkS/E0/4U+6lhMokmFSHtu
mfDZ1kGGDYhMsdytjDBztljawfawfeawefawfawfawQQDCjEsoRdgkduTy
QpbSGDIa11Jsc+XNDx2fgRinDsxXI/zJYXTKRhSl/LIPHBw/brW8vzxhOlSOrwm7
VvemkkgpAkEAwSeEw394LYZiEVv395ar9MLRVTVLwpo54jC4tsOxQCBlloocK
lYaocpk0yBqqOUSBawfIiDCuLXSdvBo1Xz5ICTM19vgvEp/+kMuECQBzm
nVo8b2Gvyagqt/KEQo8wzH2THghZ1qQ1QRhIeJG2aissEacF6bGB2oZ7Igim5L14
4KR7OeEToyCLC2k+02UCQQCrniSnWKtDVoVqeK/zbB32JhW3Wullv5p5zUEcd
KfEEuzcCUIxtJYTahJ1pvlFkQ8anpuxjSEDp8x/18bq3
-----END RSA PRIVATE KEY-----
</privatekey></keypair></createsshkeypairresponse>