Alert.png The wiki is deprecated and due to be decommissioned by the end of September 2022.
The content is being migrated to other supports, new updates will be ignored and lost.
If needed you can get in touch with EGI SDIS team using operations @ egi.eu.

Difference between revisions of "rOCCI:ROCCI-cli AWS Examples"

From EGIWiki
Jump to navigation Jump to search
Line 21: Line 21:
  occi --endpoint https://awsocci.cesnet.cz:11443/ --auth x509 --user-cred /tmp/x509up_u`id -u` --voms --action list --resource resource_tpl
  occi --endpoint https://awsocci.cesnet.cz:11443/ --auth x509 --user-cred /tmp/x509up_u`id -u` --voms --action list --resource resource_tpl


  curl --cert /tmp/x509up_u`id -u` --key /tmp/x509up_u`id -u` -H 'Content-Type: text/occi' -X GET https://awsocci.cesnet.cz:11443/-/ | grep 'occi/infrastructure#resource_tpl'
  curl --cert /tmp/x509up_u`id -u` --key /tmp/x509up_u`id -u` -H 'Content-Type: text/occi' -X GET https://awsocci.cesnet.cz:11443/-/ | \
grep 'occi/infrastructure#resource_tpl'


== Creating a Virtual Machine ==
== Creating a Virtual Machine ==

Revision as of 13:35, 27 April 2017

This page gives simple examples of using the OCCI gateway to Amazon Services as presented at the 2017 EGI Conference and Indigo Summit. You have been probably redirected here through a QR code.

Prerequisites

You need:

  • a VOMS proxy certificate. The following examples expect it to be located in file /tmp/x509up_u`id -u`
  • an OCCI client or an HTTP client
    • Examples given here use the rOCCI-cli client (available either from the EGI AppDB or from GitHub).
    • Simple HTTPs client such as curl may also be used for rudimentary management.
  • an SSH key pair (in case you really wish to log into your virtual machines). The following examples expect your public key to be located in ~/.ssh/id_rsa.pub

Examples

Listing Available Images

occi --endpoint https://awsocci.cesnet.cz:11443/ --auth x509 --user-cred /tmp/x509up_u`id -u` --voms --action list --resource os_tpl

Listing Available Resource Sizes

occi --endpoint https://awsocci.cesnet.cz:11443/ --auth x509 --user-cred /tmp/x509up_u`id -u` --voms --action list --resource resource_tpl
curl --cert /tmp/x509up_u`id -u` --key /tmp/x509up_u`id -u` -H 'Content-Type: text/occi' -X GET https://awsocci.cesnet.cz:11443/-/ | \
grep 'occi/infrastructure#resource_tpl'

Creating a Virtual Machine

VMID=$(occi --endpoint https://awsocci.cesnet.cz:11443/ --auth x509 --user-cred /tmp/x509up_u`id -u` --voms --action create --resource compute \
--mixin os_tpl#ami-971238f1 --mixin resource_tpl#t2_micro --attribute occi.core.title="VMby${USER}" \
--context public_key="file://${HOME}/.ssh/id_rsa.pub" --link /network/vpc-e2e4f686)


curl --cert /tmp/x509up_u`id -u` --key /tmp/x509up_u`id -u` -H 'Content-Type: text/occi' -X POST https://awsocci.cesnet.cz:11443/-/ \
-H 'Category: compute; scheme="http://schemas.ogf.org/occi/infrastructure#"; class="kind"' -H 'Content-Type: text/occi' \
-H 'Category: t2_micro; scheme="http://schemas.openstack.org/template/resource#"; class="mixin"' \
-H 'Category: ami-971238f1; scheme="http://schemas.openstack.org/template/os#"; class="mixin"'

Describing a Virtual Machine

occi --endpoint https://awsocci.cesnet.cz:11443/ --auth x509 --user-cred /tmp/x509up_u`id -u` --voms --action describe --resource ${VMID}
curl --cert /tmp/x509up_u`id -u` --key /tmp/x509up_u`id -u` -H 'Content-Type: text/occi' -X GET ${VMID}

Deleting a Virtual Machine

occi --endpoint https://awsocci.cesnet.cz:11443/ --auth x509 --user-cred /tmp/x509up_u`id -u` --voms --action delete --resource ${VMID}