Patrick Dunnigan writes on comp.lang.tcl[L1 ]:
I am pleased to announce the inaugural version of TclCloud, v1.0.
TclCloud is an opensource tcl interface to the Amazon AWS webservices api that enabled cloud automation of most AWS products and operations. Example use cases include the following:
For more information on the Amazon AWS cloud products, see: http://aws.amazon.com/products/
https://github.com/cloudsidekick/tclcloud
https://github.com/cloudsidekick/tclcloud/issues
General questions can be posted to comp.lang.tcl
All of the Amazon Web Services features are managed through their APIs by connecting to "endpoints" and issuing either REST or SOAP web service calls. Most programming language SDKs provide an abstraction layer to these APIs. TclCloud opens up the AWS API to the TCL developer with minimal abstraction and does not require a new release to support new AWS features to existing products (which happens quite frequently).
Responses from the AWS endpoint are returned in pure xml format which are easily parsed using tdom.
For more information on the AWS API documentation, see: http://aws.amazon.com/documentation/
To try out TclCloud you must have an Amazon AWS account with an API access key and secret key.
Note: TclCloud was developed and tested on tcl 8.6 on linux. I plan to support tcl 8.5 with TclOO and test on Windows.
Requirements - tcl 8.5 or 8.6 on linux, tcllib, TclCurl and TclOO if using 8.5.
Download the TclCloud from the Download button from the Git repository above. Unzip the contents into the lib/tclcloud directory in your tcl home directory.
Make sure you have tcllib and TclCurl installed too.
To create a new connection object, substitute your AWS provided access key and secret key. The connection new object will not attempt to create a connection to AWS, it simply creates the connection object for use.
::tclcloud::connection new <aws access key> <aws secret key>
Example:
set awsconn [::tclcloud::connection new MYACCESSKEYKJREKJ MYSECRETKEYLKJDLLKJSDDKJF]
To send a request to the AWS endpoint:
<AWS connection object> call_aws <product> <region> <action> <parameters> <api version>
To launch an Ubuntu instance, default region and api version:
package require tclcloud set awsconn [::tclcloud::connection new MYACCESSKEYKJREKJ MYSECRETKEYLKJDLLKJSDDKJF4] set return_value [$awsconn call_aws ec2 {} RunInstances { ImageId ami-1aad5273 MinCount 1 MaxCount 1 KeyName CentiviaKey SecurityGroup.1 {MySQL intranet} InstanceType t1.micro Placement.AvailabilityZone us-east-1d } {}] puts $return_value
<?xml version="1.0" encoding="UTF-8"?> <RunInstancesResponse xmlns="http://ec2.amazonaws.com/doc/2011-05-15/"> <requestId>40bfb94e-ecb8-4f49-b6ee-24b37f94ba04</requestId> <reservationId>r-0d3b3061</reservationId> <ownerId>001825975926</ownerId> <groupSet> <item> <groupId>sg-5aabe433</groupId> <groupName>MySQL intranet</groupName> </item> </groupSet> <instancesSet> <item> <instanceId>i-912f2bff</instanceId> <imageId>ami-1aad5273</imageId> <instanceState> <code>0</code> <name>pending</name> </instanceState> <privateDnsName/> <dnsName/> <reason/> <keyName>CentiviaKey</keyName> <amiLaunchIndex>0</amiLaunchIndex> <productCodes/> <instanceType>t1.micro</instanceType> <launchTime>2011-07-01T03:40:13.000Z</launchTime> <placement> <availabilityZone>us-east-1d</availabilityZone> <groupName/> <tenancy>default</tenancy> </placement> <kernelId>aki-427d952b</kernelId> <monitoring> <state>disabled</state> </monitoring> <groupSet> <item> <groupId>sg-5aabe433</groupId> <groupName>MySQL intranet</groupName> </item> </groupSet> <stateReason> <code>pending</code> <message>pending</message> </stateReason> <rootDeviceType>ebs</rootDeviceType> <rootDeviceName>/dev/sda1</rootDeviceName> <blockDeviceMapping/> <virtualizationType>paravirtual</virtualizationType> <clientToken/> <hypervisor>xen</hypervisor> </item> </instancesSet> </RunInstancesResponse>
To get a list of my machine images, default region and api version:
package require tclcloud set awsconn [::tclcloud::connection new MYACCESSKEYKJREKJ MYSECRETKEYLKJDLLKJSDDKJF] set return_value [$awsconn call_aws ec2 {} DescribeImages { Owner.1 self } {}] puts $return_value
<DescribeImagesResponse xmlns="http://ec2.amazonaws.com/doc/2011-05-15/"> <requestId>c10b0d57-964c-452e-a2ca-77aa8c49a65c</requestId> <imagesSet> <item> <imageId>ami-3012e159</imageId> <imageLocation>001825975926/Windows IIS SQL Server Small</imageLocation> <imageState>available</imageState> <imageOwnerId>001825975926</imageOwnerId> <isPublic>false</isPublic> <architecture>x86_64</architecture> <imageType>machine</imageType> <platform>windows</platform> <name>Windows IIS SQL Server Small</name> <description>Windows IIS SQL Server Small</description> <rootDeviceType>ebs</rootDeviceType> <rootDeviceName>/dev/sda1</rootDeviceName> <blockDeviceMapping> <item> <deviceName>/dev/sda1</deviceName> <ebs> <snapshotId>snap-345e8058</snapshotId> <volumeSize>30</volumeSize> <deleteOnTermination>true</deleteOnTermination> </ebs> </item> </blockDeviceMapping> <virtualizationType>hvm</virtualizationType> <tagSet> <item> <key>Name</key> <value>Windows 2008 64 Dev Instance</value> </item> </tagSet> <hypervisor>xen</hypervisor> </item> <item> <imageId>ami-40659629</imageId> <imageLocation>001825975926/Informix Linux Dev</imageLocation> <imageState>available</imageState> <imageOwnerId>001825975926</imageOwnerId> <isPublic>false</isPublic> <architecture>i386</architecture> <imageType>machine</imageType> <name>Informix Linux Dev</name> <description>Informix Linux Dev</description> <rootDeviceType>ebs</rootDeviceType> <rootDeviceName>/dev/sda1</rootDeviceName> <blockDeviceMapping> <item> <deviceName>/dev/sda1</deviceName> <ebs> <snapshotId>snap-182ef074</snapshotId> <volumeSize>10</volumeSize> <deleteOnTermination>true</deleteOnTermination> </ebs> </item> </blockDeviceMapping> <virtualizationType>paravirtual</virtualizationType> <tagSet> <item> <key>Name</key> <value>Linux Informix</value> </item> </tagSet> <hypervisor>xen</hypervisor> </item> <item> </imagesSet> </DescribeImagesResponse>