![]() One thing to note, is that these images and sizes are objects we need to pass through to the create methods, so if you know the size of Node you want unfortunately to make the library portable you cant just parse in the ID, you still need to get the NodeSize object you are after from the list, for example if you knew you wanted to create a ‘m1.small’ instance you’d have to do something like this: MY_SIZE = 'm1.small' Will output a the size list then a big list of the available node images like following (trimmed) Simply adding the following to the bottom of our script and running it again images = driver.list_images() Running that script would output something like so: Īnother helpful method is list_images() which returns a list of all the OS images that are available for our current driver (in this case just EC2 AMI’s in Sydney). The variable sizes now contains a list of all the available instance sizes in Sydney. NOTE: Remember to set the variables AWS_EC2_ACCESS_ID and AWS_EC2_SECRET_KEY to your API credentials. Now I can request a list of node sizes sizes = driver.list_sizes() ![]() Set my credentials driver = cls(AWS_EC2_ACCESS_ID, AWS_EC2_SECRET_KEY) Request the AWS EC2 Sydney provider: (remember full list here) cls = get_driver(Provider.EC2_AP_SOUTHEAST2) ![]() Include the required libraries: from import Providerįrom import get_driver The library is designed to provide a common interface to the different cloud providers, the general process is.Īs an example, if I wanted to see the EC2 instance sizes that were available in Sydney I could do the following. Sudo pip install apache-libcloud Getting started Normally installation is as easy as: sudo apt-get install python-pip if not check official installation instructions here. I am assuming you are running Ubuntu or another Debian variant. The library is not limited to provisioning servers and supports a bunch of things like load balancing, storage and even DNS but here we’ll just focus on cloud server provisioning. A full list of supported providers can be found here From the big players like Amazon AWS, Googleand Rackspace to even smaller local providers like the New Zealand based RimuHosting. Apache’s libcloud is a Python library that allows you to write code that interacts with numerous cloud service providers.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |