Difference between revisions of "rOCCI:ROCCI-cli AWS Examples"
Jump to navigation
Jump to search
Line 36: | Line 36: | ||
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/-/ \ | 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: compute; scheme="http://schemas.ogf.org/occi/infrastructure#"; class="kind"' -H 'Content-Type: text/occi' \ | ||
-H 'Category: t2_micro; scheme="http://schemas. | -H 'Category: t2_micro; scheme="http://schemas.ec2.aws.amazon.com/occi/infrastructure/resource_tpl#"; class="mixin"' \ | ||
-H 'Category: ami-971238f1; scheme="http:// | -H 'Category: ami-971238f1; scheme="http://occi.awsocci.cesnet.cz/occi/infrastructure/os_tpl#"; class="mixin"' | ||
== Describing a Virtual Machine == | == Describing a Virtual Machine == |
Revision as of 14:45, 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
- 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
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#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.ec2.aws.amazon.com/occi/infrastructure/resource_tpl#"; class="mixin"' \ -H 'Category: ami-971238f1; scheme="http://occi.awsocci.cesnet.cz/occi/infrastructure/os_tpl#"; 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}
curl --cert /tmp/x509up_u`id -u` --key /tmp/x509up_u`id -u` -H 'Content-Type: text/occi' -X DELETE ${VMID}