By Justin Lokitz
Developer: Cloud Computing
Learn how to build and deploy Oracle Database 10g Express Edition virtual images in the Amazon Elastic Compute Cloud—the "do-it-yourself" way.
Published September 2008
The promise of utility-based computing has been a long time coming. Starting out as a twinkle in the eye of mainframe computers, today there is an array of options to choose from. Whether you are running an Oracle grid using Oracle Real Application Clusters on your own physical, low-cost blade servers or relying on hosted services such as Google Applications Engine or Amazon Web Services, tapping into the power and efficiency of computers configured to give you what you need when you need it, it is a complete paradigm shift from the "big iron" models of the past. Because there are plenty of great resources for implementing Oracle grid-based systems on physical hardware, this article focuses on ways to implement Oracle technology on "clouds" of virtual servers such as those hosted by Amazon, via the Amazon Elastic Compute Cloud (EC2).
As of Sept. 21, 2008, Oracle officially certifies/supports and licenses many of its products on Amazon Web Services—furthermore, Oracle now supplies free, prebuilt virtual machine templates (or Amazon Machine Images, as Amazon calls them) for Oracle Enterprise Linux, Oracle Database 10g Express Edition (XE), all Oracle Database 11geditions, Oracle Enterprise Manager, and various Oracle Fusion Middleware components. Thus, the steps below will be of interest only to do-it-yourselfers and to people interested in how such templates are built—but knowing OTN readers, that could certainly be a lot of people! (See the Cloud Computing Center on OTN for more information.)
Amazon's Web site states, "Amazon Elastic Compute Cloud (Amazon EC2) is a Web service that provides resizable compute capacity in the cloud. It is designed to make Web-scale computing easier for developers." Diving a little deeper, what Amazon is offering here is a chance to utilize its superior network, server hardware, and expertise and the ability for any subscriber to manage the entire architecture via Web services. Moreover, because the hardware and network being used are dished out in small (and not-so-small), virtualized chunks, you can start with something akin to a single server and scale almost limitlessly without worrying about having to rent more space, buy hardware, or even install software; best of all, you pay only for what you use.
The details can be found here, but the gist is that you can pay as little as 10 cents per hour for a small instance (1.7GB of memory, one EC2 Compute Unit [one virtual core with CPU capacity equivalent to a 1.0GHz-1.2GHz 2007 Opteron or 2007 Xeon processor], 160GB of instance storage, and a 32-bit platform). What's more, as with any other virtualization platform, you can very easily create your own replication, backup, and growth strategies, using virtualized server images rather than physical hardware with installed software.
So you want to start a project or do some Oracle Application Express development on the cheap, using a single "server"? No problem. Feel like your Oracle-based project is starting to take off and you're going to need more processing power? This may be your answer.
Although you can come up with plenty of scenarios when considering how to best match the power of Oracle software with the flexibility, or elasticity, of Amazon EC2, by far the easiest, most visible, and most straightforward is simply implementing Oracle Database XE on a small EC2 instance. Because Oracle Database XE provides a relatively encapsulated and uncomplicated installation along with an embedded Web listener and an Oracle Application Express front end, using it is a great way to start. Given these factors, this article provides step-by-step instructions, based on the Amazon EC2 "Getting Started Guide," for implementing Oracle Database Express Edition on Amazon EC2.
Although the instructions this article lays out are meant to step you through each stage of the implementation without requiring a lot of prior experience with Oracle, Linux, or Amazon Web Services, they assume that you are somewhat comfortable with command-line instructions and Oracle and Linux nomenclature. Furthermore, to use the Amazon Web Service command-line tools, you must have access to an SSH client, such as PuTTY (for Windows), as well as an installation of a Java 5-compatible Java Runtime Environment (JRE). You can find instructions for downloading and installing PuTTY here and the Sun JRE here.
Signing Up for Amazon Web Services (EC2 and S3)
To implement the steps presented in this article, you must sign up for three different Amazon accounts: a central Amazon Web Services account, an Amazon Simple Storage Service (S3) account—where your Amazon image will be stored—and an Amazon Elastic Compute Cloud account. Information for all three accounts as well as Amazon's other services can be found here. To create an Amazon Web Services account, start here. Once you have created your Amazon Web Services account, make a note of your account ID. You can find it by moving your cursor over the Your Web Services Account button and selecting the Account Activity link on the menu that appears. At the top of this page, just under the Account Activity title, you should see an Account Number label followed by a hyphenated number, such as 4952-1993-3132. This is your Amazon Web Services account ID and will also serve as your EC2 user ID (with the hyphens removed: 495219933132).
Although most of this article deals with the installation and configuration of Oracle Database Express Edition on an Amazon EC2 instance, one of the most important steps is the creation and storage of an Amazon Machine Image on another service called Amazon Simple Storage Service (S3). Like the internals of Oracle Database, Amazon EC2 uses the notion of an instance, which means that a stored physical image can be used only when it is loaded in memory. Otherwise, when an image is not resident in memory, it must be permanently stored on disk somewhere until it is ready to be used again. Because Amazon EC2 offers storage, memory, and computing power only when it is resident in memory (that is, started via a Web service) and does not offer persistent storage when the image/instance is not running, you must create an Amazon S3 account to store your image when it is not running. To learn more about Amazon S3 and/or to sign up for an Amazon S3 account, visit the Amazon S3 home page and click the Sign up for this service button in the upper right corner. If you do not already have an Amazon Web Services account, you will be prompted to create one as part of the sign-up process.
Once you have created an Amazon S3 account, you will need to create an Amazon EC2 account, where you will do most of the work. To do so, log in to your Amazon Web Services account and click the link to Amazon EC2 in the Browse Web Services section on the left. Once you have been redirected to the EC2 home page, click the Sign Up For Web Service button at the top right of the screen and follow the on-screen instructions.
As soon as you have finished creating the EC2 account, you will need to create a new X.509 secure certificate and an associated key file. You will use these to remotely log in to the EC2 service later. To create a new X.509 certificate, move your cursor over the Your Web Services Account button and select the View Access Key Identifiers link on the menu that appears. In the X.509 Certificate section, click the Create New button. follow the link to create a new X.509 certificate, and save the certificate and the private key. Create an .ec2 directory in your home directory, and save these files to it with the filenames offered by your browser. Once you have completed these steps and have saved these files, you should end up with a PEM-encoded X.509 certificate and a private key file with names similar to those in the examples below:
The X.509 certificate you create will be associated with your account until you generate or upload a new certificate. If you have an existing certificate you would prefer to use, you can come back to the Access Key Identifiers page later and upload that one instead.
Sun Microsystems JRE. Because most of the command-line Tools used to manage Amazon Web Services require Java version 5 or later, you will need to install and configure a Java Runtime Environment (JRE) or a Java Development Kit (JDK). Sun Microsystems provides implementations for a range of platforms, including Linux and Windows, which you can download and install from here if you don't already have one configured.
With a JRE or a JDK installed and configured, set up a JAVA_HOME environmental variable (which will be used by the Amazon Web Service Tools). This variable should be set to the full path of the directory that contains a subdirectory named bin, which, in turn, contains the java (on Linux/UNIX) or the java.exe (on Windows) executable. You may also want to simplify things by adding this directory to your path before other versions of Java.
To temporarily set the JAVA_HOME environmental variable in Windows (from a command prompt) , issue the following command:
C:\> set JAVA_HOME=<PATH>
You can also permanently set the JAVA_HOME environmental variable in Windows by doing the following:
To confirm your JAVA_HOME environmental variable in Windows (from a command prompt), issue the following command:
C:\> %JAVA_HOME%\bin\java version
java version "1.5.0_14"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_14-b03)
Java HotSpot(TM) Client VM (build 1.5.0_14-b03, mixed mode)
PuTTY and Associated Tools. Because most of the implementation covered in this article is done remotely on a Linux instance via SSH, you will need a suitable SSH client. Although most UNIX/Linux distributions come with a built-in SSH client, Windows typically does not. For that reason, if you are using Windows, you must install an SSH client such as PuTTY (which is a great, free SSH client with lots of extras)
Because you will use the PuTTY SSH client as well as the PSCP and PuTTYGen utilities covered in this article, by far the easiest way to set up these Tools is to download the putty.zip file from here. This file contains all the necessary binaries (except PuTTYtel) and also the help files. Once the download is complete
As mentioned earlier, Amazon includes a set of command-line Tools that enable you to manage your Amazon EC2 instance remotely. As before with the PuTTY tools, no installation is necessary for these Tools. As long as you have properly set up your JAVA_HOME environmental variable, you should be able to simply unzip the Amazon EC2 command-line Tools into a new directory.
Once you have unzipped the command-line Tools into a new directory, such as C:\Program Files\EC2, you must set up an environmental variable to tell your system where the Tools can be found. To do this, you will need to set an environmental variable named EC2_HOME that points to the command-line Tools folder (where you unzipped the Tools). Using Windows (from the command prompt), issue the following command:
C:\> set EC2_HOME=<path-to-tools>
C:\> set PATH=%PATH%;%EC2_HOME%\bin
Alternatively, as before, you can permanently set the EC2_HOME environmental variable, as a user variable or a system variable, by doing the following:
The command-line Tools will also need access to the private key and the X.509 certificate you generated after signing up for the Amazon EC2 service. To make this simple, you can set up two new environmental variables, named EC2_PRIVATE_KEY and EC2_CERT, that will point to your private key file and X509 certificate, respectively. To set up these environmental variables, issue the following command:
C:\> set EC2_PRIVATE_KEY=c:\ec2\pk-HKZYKTAIG2ECMXYIBH3HXV4ZBZQ55CLO.pem
C:\> set EC2_CERT=c:\ec2\cert-HKZYKTAIG2ECMXYIBH3HXV4ZBZQ55CLO.pem
As with other environmental variables, you can permanently set EC2_PRIVATE_KEY and EC2_CERT in Windows by doing the following:
One of the nicest and most time-saving features of Amazon EC2 is the ability to publish, find, reuse, and repurpose Amazon Machine Images (AMIs).
As with most other virtualization sulutions, Amazon makes it very easy to create and use new images. However, where Amazon EC2 is different is that because the images you create are maintained by Amazon and not downloaded onto local servers, you have the choice to share and use images created by you and others, including those created by Amazon. Hence, with a catalog of public AMIs to choose from, one thing we do not have to worry about in this article is installing and configuring an operating system; all we have to do is find one we like.
As I mentioned in the introduction, Oracle is now supplying pre-built AMIs free of charge, so many of the steps described below are now of interest only to people who wish to build their own AMIs. Note however that only the Oracle-provided AMIs are licensable and certified.
To find an AMI suitable for use with Oracle Database XE (or anything else), you can simply run an EC2 command-line tools (ec2-describe-images). With Windows, this looks something like this:
C:\> ec2-describe-images -o self -o amazon
IMAGE ami-bd9d78d4 ec2-public-images/demo-paid-AMI.manifest.xml amazon
available public A79EC0DB i386 machine
IMAGE ami-26b6534f ec2-public-images/developer-image.manifest.xml amazon
available public i386 machine
IMAGE ari-a51cf9cc ec2-public-images/ec2-initrd-2.6.21.7-2.fc8xen.i386.mani
fest.xml amazon available public i386 ramdisk
IMAGE ari-b31cf9da ec2-public-images/ec2-initrd-2.6.21.7-2.fc8xen.x86_64.ma
nifest.xml amazon available public x86_64 ramdisk
IMAGE aki-a71cf9ce ec2-public-images/ec2-vmlinuz-2.6.21.7-2.fc8xen.i386.man
ifest.xml amazon available public i386 kernel
IMAGE aki-b51cf9dc ec2-public-images/ec2-vmlinuz-2.6.21.7-2.fc8xen.x86_64.m
anifest.xml amazon available public x86_64 kernel
IMAGE ami-f51aff9c ec2-public-images/fedora-8-i386-base-v1.06.manifest.xml
amazon available public i386 machine aki-a71cf9ce ari-a51c
f9cc
IMAGE ami-f21aff9b ec2-public-images/fedora-8-x86_64-base-v1.06.manifest.xm
l amazon available public x86_64 machine aki-b51cf9dc
ari-b31cf9da
IMAGE ami-a21affcb ec2-public-images/fedora-core-6-x86_64-base-v1.06.manife
st.xml amazon available public x86_64 machine aki-a53adfcc
ari-a23adfcb
.....
As you can see, there are plenty of premade public AMIs to choose from. The one we will use in this article is the image with the ID ami-f51aff9c and the name ec2-public-images/fedora-8-i386-base-v1.06.manifest.xml. This AMI is one that already comes preloaded with the Fedora 8 Linux distribution.
Because it is easiest to start with a public instance for making your own and because the public instances listed with the commands above do not have passwords, you will need a public/private key pair to log in to the instance; half of this key pair will be embedded into your instance, allowing you to log in securely without a password, using the other half of the key pair. As you create more-advanced, customized AMIs, you can choose from a wide array of authentication options. However, in this case, we will use a simple key pair with the unique name gsg-keypair (you can choose any name you will remember). To generate a new key pair with the name gsg-keypair, using the command-line Tools for Windows, simply run the ec2-add-keypair command-line tools:
C:\> ec2-add-keypair gsg-keypair
KEYPAIR gsg-keypair 1f:51:ae:28:bf:89:e9:d8:1f:25:5d:37:2d:7d:b8:ca:9f:f5:f1:6f
-----BEGIN RSA PRIVATE KEY-----
MIIEoQIBAAKCAQBuLFg5ujHrtm1jnutSuoO8Xe56LlT+HM8v/xkaa39EstM3/aFxTHgElQiJLChp
HungXQ29VTc8rc1bW0lkdi23OH5eqkMHGhvEwqa0HWASUMll4o3o/IX+0f2UcPoKCOVUR+jx71Sg
5AU52EQfanIn3ZQ8lFW7Edp5a3q4DhjGlUKToHVbicL5E+g45zfB95wIyywWZfeW/UUF3LpGZyq/
ebIUlq1qTbHkLbCC2r7RTn8vpQWp47BGVYGtGSBMpTRP5hnbzzuqj3itkiLHjU39S2sJCJ0TrJx5
i8BygR4s3mHKBj8l+ePQxG1kGbF6R4yg6sECmXn17MRQVXODNHZbAgMBAAECggEAY1tsiUsIwDl5
91CXirkYGuVfLyLflXenxfI50mDFms/mumTqloHO7tr0oriHDR5K7wMcY/YY5YkcXNo7mvUVD1pM
ZNUJs7rw9gZRTrf7LylaJ58kOcyajw8TsC4e4LPbFaHwS1d6K8rXh64o6WgW4SrsB6ICmr1kGQI7
3wcfgt5ecIu4TZf0OE9IHjn+2eRlsrjBdeORi7KiUNC/pAG23I6MdDOFEQRcCSigCj+4/mciFUSA
SWS4dMbrpb9FNSIcf9dcLxVM7/6KxgJNfZc9XWzUw77Jg8x92Zd0fVhHOux5IZC+UvSKWB4dyfcI
tE8C3p9bbU9VGyY5vLCAiIb4qQKBgQDLiO24GXrIkswF32YtBBMuVgLGCwU9h9HlO9mKAc2m8Cm1
jUE5IpzRjTedc9I2qiIMUTwtgnw42auSCzbUeYMURPtDqyQ7p6AjMujp9EPemcSVOK9vXYL0Ptco
xW9MC0dtV6iPkCN7gOqiZXPRKaFbWADp16p8UAIvS/a5XXk5jwKBgQCKkpHi2EISh1uRkhxljyWC
iDCiK6JBRsMvpLbc0v5dKwP5alo1fmdR5PJaV2qvZSj5CYNpMAy1/EDNTY5OSIJU+0KFmQbyhsbm
rdLNLDL4+TcnT7c62/aH01ohYaf/VCbRhtLlBfqGoQc7+sAc8vmKkesnF7CqCEKDyF/dhrxYdQKB
gC0iZzzNAapayz1+JcVTwwEid6j9JqNXbBc+Z2YwMi+T0Fv/P/hwkX/ypeOXnIUcw0Ih/YtGBVAC
DQbsz7LcY1HqXiHKYNWNvXgwwO+oiChjxvEkSdsTTIfnK4VSCvU9BxDbQHjdiNDJbL6oar92UN7V
rBYvChJZF7LvUH4YmVpHAoGAbZ2X7XvoeEO+uZ58/BGKOIGHByHBDiXtzMhdJr15HTYjxK7OgTZm
gK+8zp4L9IbvLGDMJO8vft32XPEWuvI8twCzFH+CsWLQADZMZKSsBasOZ/h1FwhdMgCMcY+Qlzd4
JZKjTSu3i7vhvx6RzdSedXEMNTZWN4qlIx3kR5aHcukCgYA9T+Zrvm1F0seQPbLknn7EqhXIjBaT
P8TTvW/6bdPi23ExzxZn7KOdrfclYRph1LHMpAONv/x2xALIf91UB+v5ohy1oDoasL0gij1houRe
2ERKKdwz0ZL9SWq6VTdhr/5G994CK72fy5WhyERbDjUIdHaK3M849JJuf8cSrvSb4g==
-----END RSA PRIVATE KEY-----
This creates a private key that must be copied and saved to a local file. To do this, open your favorite text editor (Notepad or TextPad for Windows works great) and create a new document named id_rsa-gsg-keypair, copy and paste everything between (and including) the "-----BEGIN RSA PRIVATE KEY-----" and "-----END RSA PRIVATE KEY-----" lines into it, and then save the file to any directory you wish.
If you are using PuTTY on Windows, the key pair you just created will have to be converted to a PuTTY-ready format. To do this:
Now comes one of the most important steps in the process: starting up the server instance so you can begin to install Oracle Database XE onto it. Although you might figure that there would be a lot of fanfare and complicated procedures to do this, especially considering that this is a public Linux AMI, this step is actually quite easy. To start the Fedora 8 instance you found in a previous step, simply run the ec2-run-instances command-line tools, using the reference to the AMI and the key pair you created:
C:\> ec2-run-instances ami-f51aff9c -k gsg-keypair
RESERVATION r-7430c31d 924417782495 default
INSTANCE i-ae0bf0c7 ami-2bb65342 pending gsg-keypair 0 m1.small
2008-03-21T16:19:25+0000 us-east-1a
(Note: the instance ID in the second field of the output [i-ae0bf0c7 in this example] is a unique identifier for the instance, and you will use it later to manipulate this instance [including terminating it when you are finished].>
As with almost any other server startup, this server instance may take a couple of minutes to start. You can check the status with the ec2-describe-instances command-line tools:
C:\> ec2-describe-instances i-ae0bf0c7
RESERVATION r-7430c31d 924417782495 default
INSTANCE i-ae0bf0c7 ami-2bb65342 ec2-67-202-7-236.compute-1.amazonaws.com ip-10-251-31-162.ec2.internal
running gsg-keypair 0 m1.small 2008-03-21T16:19:25+0000us-east-1a
(Note: once the instance is started, you can use the ec2-describe-instances command-line tools to find external and internal DNS [network] names. In this example, you would use ec2-67-202-7-236.compute-1.amazonaws.com to reach your instance externally and ip-10-251-31-162.ec2.internal to reach it internally. In other words, if you see this message upon running ec2-describe-instance, your server is running [and you are also paying for time on it].)
To support maximum availability and security, Amazon EC2 offers several command-line Tools that enable you to configure network access and authorization akin to firewall settings. Because you will want to access your instance via SSH and—more than likely—HTTP, you will need to use the ec2-authorize command-line tools to open access to those ports:
C:\> ec2-authorize default -p 22
PERMISSION default ALLOWS tcp 22 22 FROM CIDR 0.0.0.0/0
C:\> ec2-authorize default -p 8090
PERMISSION default ALLOWS tcp 8080 8080 FROM CIDR 0.0.0.0/0
(Note: this article covers configuring Oracle Database XE to use port 8080. If you would rather use another port, you must authorize access to it by using the ec2-authorize command-line tools as in the above example.)
With your server started and its SSH port (22 in this example) open, you can now use SSH to remotely log in and access your instance as you would any other remote server. To do so, follow these steps:
This should log you in to your instance, whereby you will have all the standard Linux commands available to you, as you would on any other Fedora Linux server.
As with any other Oracle implementation, there are plenty of ways you can download and implement Oracle software for your own needs or the needs of your particular project and/or organization. Given that there are many ways to do this, there are just as many best practices you may want to follow to implement exactly what you want or need. This section guides you through a simple implementation of Oracle Database XE on an Amazon EC2 instance. Once you have completed this section, you may want to do your own research and add to these steps, based on your needs and other best practices.
To install Oracle, you will first need to get a copy of the Oracle Database XE software to your Linux instance. Although there are plenty of ways do this, the easiest—although possibly the most time consuming—is to log in to OTN, download the Oracle Database XE software for Linux (RPM version), and then copy it to your Linux AMI via an SCP command (or PSCP command on Windows). To do this, once you have downloaded the Oracle DatabaseXE software to the local machine where you are running the EC2 commands and the SSH client, use an SCP command (PSCP on Windows) such as the following:
C:\ pscp -i id_rsa-gsg-keypair.ppk F:\Software\ora10g\xe\oracle-xe-10.2.0.1-1.0.i386.rpm root@ ec2-67-202-7-236.compute-1.amazonaws.com:/home
(Note: this will copy the Oracle Database XE software into the home directory, using the root user's account. You can change this to suit your own needs.)
While the Oracle Database XE software is being copied to your Linux AMI, log in to your Linux instance, using SSH (PuTTY), so that you can make some final preparations (read installations) for its new home. The first preparatory step is to configure a new library called libaio, which is an asynchronous I/O library not necessarily found on all Linux distributions but one that Oracle Database definitely needs. You can do this while logged in to your instance via SSH (PuTTY):
$yum install libaio
This command should immediately check with a couple of mirror sites for the latest and greatest (and most available) libaio library and will proceed to ask you if you want to download and install it (which you do). Here's what the output should look like:
Loading "fastestmirror" plugin
Determining fastest mirrors
* fedora: mirror.cogentco.com
* updates: mirror.cogentco.com
fedora 100% |=========================| 2.1 kB 00:00
primary.sqlite.bz2 100% |=========================| 4.9 MB 00:00
updates 100% |=========================| 2.3 kB 00:00
primary.sqlite.bz2 100% |=========================| 3.0 MB 00:00
Setting up Install Process
Parsing package install arguments
Resolving Dependencies
--> Running transaction check
---> Package libaio.i386 0:0.3.106-3.2 set to be updated
--> Finished Dependency Resolution
Dependencies Resolved
============================================================================
Package Arch Version Repository Size
============================================================================
Installing:
libaio i386 0.3.106-3.2 fedora 19 k
Transaction Summary
============================================================================
Install 1 Package(s)
Update 0 Package(s)
Remove 0 Package(s)
Total download size: 19 k
Is this ok [y/N]: y
Downloading Packages:
(1/1): libaio-0.3.106-3.2 100% |=========================| 19 kB 00:00
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing: libaio ######################### [1/1]
Installed: libaio.i386 0:0.3.106-3.2
Complete!
Once that command has been run and the Oracle Database XE software has been successfully copied to your Linux instance, you can continue the installation by entering the following command at the Linux command prompt:
$ rpm -ivh oracle-xe-10.2.0.1-1.0.i386.rpm
This command first unpacks the Oracle Database XE software and then installs and configures it, based on your input. During the install, the first prompt you get will say something like this: "You must run '/etc/init.d/oracle-xe configure' as the root user to configure the database." Because you are already logged in as root, you can simply type the following at the command prompt:
$ /etc/init.d/oracle-xe configure
With this command entered and run, Oracle Database XE will begin its post-configuration steps and ask you to input your preferred HTTP port (8080 by default), a database listener (1521 by default), and a password to be used for all DBA accounts. Last, you will get a final prompt, asking whether you want to start the Oracle Database XE instance. When all is said and done, you will have Oracle Database XE up and running on your system. Now comes the fun part: customizing your instance.
With Oracle Database XE up and running on your Linux instance, you may want to take some time to really make it your own. One of the things you can do right off the bat is set the path for your users so that you can use SQL*Plus from the command prompt without having to change to the Oracle BIN directory. To do this from the Linux command prompt, enter the following:
$ export ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server
$ export ORACLE_SID=XE
$ export PATH=$PATH:$ORACLE_HOME/bin
You can also make things really interesting by enabling Oracle Database Express Edition to listen for remote connections (which will allow you—and others—to connect to Oracle Application Express from the internet). To do this from the Linux command prompt, enter this:
$ sqlplus system/password (*where password is your system password)
$ EXEC DBMS_XDB.SETLISTENERLOCALACCESS(FALSE);
Now you should be able to open a Web browser anywhere and use your instance of Oracle Application Express by navigating to your Amazon EC2 public address, followed by port 8080 (http://ec2-75-101-206-200.compute-1.amazonaws.com:8080/).
If you are familiar with the Oracle Database XE and Oracle Application Express environments, you should be able to customize just about anything you desire.
To this point, you have been working on an instance that you have made your own from another public AMI. However, once the instance is terminated, your work will be lost—unless, of course, you take what you have created and register your own AMI. (Or, of course, you can always use the free one supplied by Oracle.) To do this, you will use some simple bundling commands that will apply your keys to your instance, bundle up the entire instance, and then copy it to Amazon S3. Once you have bundled your instance and copied it to S3's permanent storage, you will be able to use it again and again without having to reinstall Oracle Database XE. To create your own AMI, do the following:
C:\> pscp -i id_rsa-gsg-keypair.ppk pk-OVELY2MOG3K2VUXVRI3GPZE4457E42LK.pem cert-OVELY2MOG3K2VUXVRI3GPZE4457E42LK.pem
root@ec2-75-101-206-200.compute-1.amazonaws.com:/mnt
$ ec2-bundle-vul -d /mnt -k /mnt/pk-OVELY2MOG3K2VUXVRI3GPZE4457E42LK.pem -c
/mnt/cert-OVELY2MOG3K2VUXVRI3GPZE4457E42LK.pem -u 117080109999 -r i386
$ ec2-upload-bundle -b oraclexe -m /mnt/image.manifest.xml -a 1HAY961AK34CXHKWNWG2
-s LJiWWdBmk7fuaPYOzUtHfxwhCEOgASTmnUXTpxDM
C:\> ec2-register oraclexe/image.manifest.xml IMAGE ami-7daf4b14
(Note: the AMI ID returned in this example is an ID for an actual AMI that was created for this article.
Feel free to use it as a reference.)As mentioned earlier, you have been using a public AMI for your EC2 instance up to now. However, once you have created, uploaded, and registered your instance via Amazon EC2 and S3, you will have something you can call your own: an AMI built to your specifications that can be used by you alone or shared with anyone. The important part is that you understand what the costs are of running Amazon Web Services and that you use your best judgment and best practices when starting your AMI as an instance or publishing it to the world.
With all of the "hard" steps complete, all you have to do now is start and/or stop your instance. If your instance is currently running, you simply use the ec2-terminate-instances command-line tools (from Windows) followed by the instance ID to shut it down. For example, to stop the instance whose ID is i-ae0bf0c7, referenced at the beginning of this article, you would run the following:
C:\> ec2-terminate-instances i-ae0bf0c7
This would terminate the instance with that ID, and if you wanted to start it again, you would have to use the ec2-run-instances command-line tools followed by the new AMI ID created for you (ami-7daf4b14):
C:\> ec2-run-instances ami-7daf4b14 -k gsg-keypair
If you ever felt you wanted to start the entire process over, soup-to-nuts, and wanted to wipe out the AMI and the associated bundle you had created, you would use the following steps:
C:\> ec2-deregister ami-7daf4b14
ec2-delete-bundle -b oraclexe -p image -a 1HAY961AK34CXHKWNWG2 -s LJiWWdBmk7fuaPYOzUtHfxwhCEOgASTmnUXTpxDM
Cloud computing services offer a world of potential that, in many cases, cannot be matched by other hosting options. Whether you're looking for vast computing power, unlimited storage, or cheap development servers, it would seem that services such as Amazon's EC2 and S3 offer it all. Although this article describes how you could put Amazon Web Services to good use with an Oracle Database XE instance, it goes without saying that the sky is definitely not the limit.
Justin Lokitz [ justin.lokitz@autodesk.com] is a product manager for Autodesk Inc.