ami-generator Generation of Amazon EC2 images
All images generated by this tool are 64-bit Linux "t1.micro" machines, suitable for running on the AWS Free Usage Tier. User name for the Ubuntu images is "ubuntu", and for the other images is "ec2-user". There is a readme.txt
in the home folder of each image explaining how to get started with the installed software.
About this page PerfectAPI - your API, done right
This page is a demo page for PerfectAPI - a set of open-source tools for creating service APIs. The projects that make up the toolset are hosted on GitHub. Some of the features that are used in this app are:
- Self-configuring endpoint
- Simply add a script reference to the provided javascript file in your HTML and then you can directly call the exposed methods of that API without further knowledge of urls
- Simple rpc-style calls
- Calls to the api are simple asynchronous calls in the rpc style (see code below). There is no Ajax, JSON, JSONP, REST to worry about - its just simple Javascript code
- Long-running API calls
- Generating an image can take a while. Normally, this would timeout after 15-30 seconds, however this does not happen with PerfectAPI.
- Test Page
- This page is a custom page, but there is also an automatically generated "test" page for the API, where you can explore the API and see actual code in the language of your choice.
This page is static html5 hosted on Amazon S3 using Amazon's guidelines. The reason that the page is able to have non-static functionality is that it uses Javascript to communicate with a service-backend on another server. There are several Javascript calls to the backend service on this page:
<!-- Reference the service endpoint. This is all the configuration you need. --> <script src="https://services.perfectapi.com/amigen/jquery.perfectapi.js"></script> <!-- Use the API. --> <script> amigen.callApi('scripts', function(err, data) { //binding code removed for clarity - populate select boxes with lists of distros and scripts }); amigen.callApi('regions', function(err, data) { //binding code removed for clarity - populate select box with lists of AWS regions }); </script>and to generate the image (simplified):
//get config from page var config = {}; config.scripts = $('#amiScripts').val(); config.options = {}; config.options.region = $('#region').val(); config.options.publish = true; amigen.callApi('gen', config, function(err, result) { //generates an image using the supplied config $('#amiLink').text(result.ami); $('#amiLink').attr("href", "https://console.aws.amazon.com/ec2/home?region=" + result.region + "#launchAmi=" + result.ami); $('#imageSuccess').show(); });
This syntax for the remote procedure call (rpc) is the same as all PerfectAPIs - a command name (gen
above), an optional config
, and a callback function which will be executed when the command is done. It does not matter how long the command takes - it will not timeout.
About ami-generator
The app came into being because of my own need to find trustworthy Linux images with the software I needed. It is easy to find a good base image, but the manual steps to get things working securely and well were burdensome. So I created this app which generates an image to the spec that I want.
In addition to working software, it was important to me that the images be ready for Internet use, i.e. fully patched, hardened against hacking attacks. All amigen images install security updates daily, and are hardened against common attacks for the software they install.
If there is software that you would like added, please let me know at ami-requests@perfectapi.com. The repository for this software together with the scripts is on Github - https://github.com/perfectapi/ami-generator.