How to access and use the ExoScale IaaS?
Account creation
- Send an email to francisco.mendonca@hesge.ch with the following information: each group member name and email
- You will receive a registration link with a token allowing you to create an account with a 20CHF credit.
- Follow the link and create your account
- Validate your email
- fill-up the form with your information
Create an instance using the ExoScale console
The following tutorial will guide you through the creation of your first instance.
https://community.exoscale.com/documentation/compute/quick-start/
Setting up a local dev. environment
ExoScale developed its own Python library so we can interact with its platform. here is how to install it.
-
Install the ExoScale Python library
pip install exoscale
-
Open the ExoScale console on the "IAM" page and create creditors
Choose a name and use an unrestricted key and click on create. Warning: Unrestricted keys are not good practices. Be aware that in a production environment you should prefer restricted keys.
- Write down your key and your secret
- Do:
export EXOSCALE_API_KEY="EXOxxxxxxxxxxxxxxxxx" EXOSCALE_API_SECRET="xxxxxxxxxxxxxxxxxxxxxxxxxxxx"
Resources and code examples
ExoScale Python library documentation
https://exoscale.github.io/python-exoscale/index.html
https://exoscale.github.io/python-exoscale/exoscale.api.compute.html
Code example
Creation of an Instance
instance = exo.compute.create_instance(
name="web1",
zone=zone_gva2,
type=exo.compute.get_instance_type("medium"),
template=list(
exo.compute.list_instance_templates(
zone_gva2,
"Linux Ubuntu 18.04 LTS 64-bit"))[0],
volume_size=50,
security_groups=[security_group_web],
)
Get the status of the Instance
for instance in exo.compute.list_instances():
print("{name} {zone} {ip}".format(
name=instance.name,
zone=instance.zone.name,
ip=instance.ipv4_address,
))
Deletion of an Instance
instance.delete()
Pushing to S3 Bucket
bucket= exo.storage.get_bucket("bucket_name")
result = bucket.put_file(local_file_name, file_name_in_bucket)
Reading from s3 bucket
bucket= exo.storage.get_bucket("bucket_name")
file = bucket.get_file(file_name_in_bucket)More Information
https://www.exoscale.com/syslog/official-python-bindings-for-the-exoscale-api/
If you have any questions, please contact francisco(dot)mendonca(at)hesge(dot)ch